From 16bbabb3e3101d35747e7eda31ba3581a8ccc50e Mon Sep 17 00:00:00 2001 From: Moritz Hedtke Date: Sun, 12 Oct 2025 05:04:00 +0200 Subject: [PATCH] Fix base path for wasm splitting (#4770) --- packages/cli/src/build/request.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/build/request.rs b/packages/cli/src/build/request.rs index d2fc71df0..a6fe2e574 100644 --- a/packages/cli/src/build/request.rs +++ b/packages/cli/src/build/request.rs @@ -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