Fix base path for wasm splitting (#4770)
This commit is contained in:
1 parent
11b2ea7f39
commit
16bbabb3e3
1 file changed
+4
-2
@@ -3968,7 +3968,8 @@ impl BuildRequest {
|
|||||||
let path = bindgen_outdir.join(format!("chunk_{}_{}.wasm", idx, chunk.module_name));
|
let path = bindgen_outdir.join(format!("chunk_{}_{}.wasm", idx, chunk.module_name));
|
||||||
wasm_opt::write_wasm(&chunk.bytes, &path, &wasm_opt_options).await?;
|
wasm_opt::write_wasm(&chunk.bytes, &path, &wasm_opt_options).await?;
|
||||||
writeln!(
|
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
|
url = assets
|
||||||
.register_asset(&path, AssetOptions::builder().into_asset_options())?.bundled_path(),
|
.register_asset(&path, AssetOptions::builder().into_asset_options())?.bundled_path(),
|
||||||
)?;
|
)?;
|
||||||
@@ -3992,9 +3993,10 @@ impl BuildRequest {
|
|||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
glue,
|
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,
|
module = module.module_name,
|
||||||
|
|
||||||
|
base_path = self.base_path_or_default(),
|
||||||
|
|
||||||
// Again, register this wasm with the asset system
|
// Again, register this wasm with the asset system
|
||||||
url = assets
|
url = assets
|
||||||
|
|||||||
Reference in new issue
Block a user