Skip to content

Fix bundler looking for index.<chunk_hash>.wasm#16

Open
greym0uth wants to merge 1 commit intonshen:mainfrom
greym0uth:jg/fix-bundling
Open

Fix bundler looking for index.<chunk_hash>.wasm#16
greym0uth wants to merge 1 commit intonshen:mainfrom
greym0uth:jg/fix-bundling

Conversation

@greym0uth
Copy link
Copy Markdown
Contributor

@greym0uth greym0uth commented May 21, 2022

Seems like I missed something in my initial PR as that made it work for vite but didn't work with vite build and vite preview.

It seems newer versions of wasm-pack or at least my version uses import.meta.url for getting the current file, so the existing regex replace isn't capturing it so I get a 404 fetching the wasm as its looking for index.<chunk_hash>_bg.wasm which doesnt exist.

This also uses the transform hook to replace the input in the modulePaths entry file's because I was running into an issue with pnpm caching; I just removed the isNodeModule logic from the buildStart as the transform handles that piece now. I left the cratePaths variant in the buildStart as it relies on the fs.copy so I didn't want to break anything in that aspect.

@nshen
Copy link
Copy Markdown
Owner

nshen commented Jul 26, 2024

hi @greym0uth thanks for you PR, please check #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants