Fix base path for wasm splitting (#4770)

This commit is contained in:
Moritz Hedtke authored and GitHub committed 2025-10-11 20:04:00 -07:00
1 parent 11b2ea7f39
commit 16bbabb3e3
1 file changed
+4 -2
+4 -2
View File
@@ -3968,7 +3968,8 @@ impl BuildRequest {
let path = bindgen_outdir.join(format!("chunk_{}_{}.wasm", idx, chunk.module_name));
wasm_opt::write_wasm(&chunk.bytes, &path, &wasm_opt_options).await?;
writeln!(
glue, "export const __wasm_split_load_chunk_{idx} = makeLoad(\"/assets/{url}\", [], fusedImports);",
glue, "export const __wasm_split_load_chunk_{idx} = makeLoad(\"/{base_path}/assets/{url}\", [], fusedImports);",
base_path = self.base_path_or_default(),
url = assets
.register_asset(&path, AssetOptions::builder().into_asset_options())?.bundled_path(),
)?;
@@ -3992,9 +3993,10 @@ impl BuildRequest {
writeln!(
glue,
"export const __wasm_split_load_{module}_{hash_id}_{comp_name} = makeLoad(\"/assets/{url}\", [{deps}], fusedImports);",
"export const __wasm_split_load_{module}_{hash_id}_{comp_name} = makeLoad(\"/{base_path}/assets/{url}\", [{deps}], fusedImports);",
module = module.module_name,
base_path = self.base_path_or_default(),
// Again, register this wasm with the asset system
url = assets