fix: fixed wasm and js paths in release mode (#4140)

This commit is contained in:
VipWW authored and GitHub committed 2025-05-19 15:54:48 +02:00
1 parent 18477a0373
commit 0a18c12c32
1 file changed
+7 -7
+7 -7
View File
@@ -3148,11 +3148,8 @@ impl BuildRequest {
// In release mode, we make the wasm and bindgen files into assets so they get bundled with max
// optimizations.
let wasm_path = if self.release && !should_bundle_split {
// Register the main.js with the asset system so it bundles in the snippets and optimizes
let name = assets.register_asset(
&self.wasm_bindgen_js_output_file(),
AssetOptions::Js(JsAssetOptions::new().with_minify(true).with_preload(true)),
)?;
// Make sure to register the main wasm file with the asset system
let name = assets.register_asset(&post_bindgen_wasm, AssetOptions::Unknown)?;
format!("assets/{}", name.bundled_path())
} else {
let asset = self.wasm_bindgen_wasm_output_file();
@@ -3160,8 +3157,11 @@ impl BuildRequest {
};
let js_path = if self.release && !should_bundle_split {
// Make sure to register the main wasm file with the asset system
let name = assets.register_asset(&post_bindgen_wasm, AssetOptions::Unknown)?;
// Register the main.js with the asset system so it bundles in the snippets and optimizes
let name = assets.register_asset(
&self.wasm_bindgen_js_output_file(),
AssetOptions::Js(JsAssetOptions::new().with_minify(true).with_preload(true)),
)?;
format!("assets/{}", name.bundled_path())
} else {
let asset = self.wasm_bindgen_js_output_file();