Skip to content

Commit

Permalink
chore: push built-in plugins (#16)
Browse files Browse the repository at this point in the history
* chore: push built-in plugins

* chore: add default plugin
  • Loading branch information
ClarkXia authored Nov 30, 2023
1 parent f277b98 commit 3ef40f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions crates/binding_options/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
3 changes: 3 additions & 0 deletions crates/binding_options/src/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 1 addition & 6 deletions crates/plugin_manifest/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit 3ef40f2

Please sign in to comment.