From 3ef40f2cc23eff73738263c4015fbd82d3c27de4 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 30 Nov 2023 14:16:59 +0800 Subject: [PATCH] chore: push built-in plugins (#16) * chore: push built-in plugins * chore: add default plugin --- crates/binding_options/Cargo.toml | 1 + crates/binding_options/src/options/mod.rs | 3 +++ crates/plugin_manifest/src/plugin.rs | 7 +------ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/binding_options/Cargo.toml b/crates/binding_options/Cargo.toml index a0a45e8..5163393 100644 --- a/crates/binding_options/Cargo.toml +++ b/crates/binding_options/Cargo.toml @@ -48,6 +48,7 @@ rspack_hash = { path = "../.rspack_crates/rspack_has rspack_swc_visitors = { path = "../.rspack_crates/rspack_swc_visitors" } loader_compilation = { path = "../loader_compilation" } plugin_manifest = { path = "../plugin_manifest" } +## plugin_specilize_module_name = { path = "../plugin_specilize_module_name" } futures-util = { workspace = true } anyhow = { workspace = true, features = ["backtrace"] } diff --git a/crates/binding_options/src/options/mod.rs b/crates/binding_options/src/options/mod.rs index 2d8a912..b7b24d4 100644 --- a/crates/binding_options/src/options/mod.rs +++ b/crates/binding_options/src/options/mod.rs @@ -164,6 +164,9 @@ impl RawOptionsApply for RSPackRawOptions { plugins.push(rspack_plugin_warn_sensitive_module::WarnCaseSensitiveModulesPlugin.boxed()); + // Add custom plugins. + plugins.push(plugin_manifest::ManifestPlugin::new().boxed()); + Ok(Self::Options { context, mode, diff --git a/crates/plugin_manifest/src/plugin.rs b/crates/plugin_manifest/src/plugin.rs index 8bbde27..c2e6cab 100644 --- a/crates/plugin_manifest/src/plugin.rs +++ b/crates/plugin_manifest/src/plugin.rs @@ -91,13 +91,8 @@ impl Plugin for ManifestPlugin { } }); let json_string = serde_json::to_string(&assets_mainfest).unwrap(); - let output_path = compilation - .options - .output - .path - .join("assets-manifest.json".to_string()).to_string_lossy().to_string(); compilation.emit_asset( - output_path, + "assets-manifest.json".to_string(), CompilationAsset::from(RawSource::from(json_string).boxed()), ); Ok(())