-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix JS bundling fallback #4450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix JS bundling fallback #4450
Conversation
|
Is SWC just failing here because we're not copying the referenced assets over? Maybe we could customize the path loader config argument to use the crate's root as a fallback. I'm not a huge fan of adding a CLI arg to work around a bug rather than fixing the underlying issue itself, if we can. |
|
This is an issue with the swc bundler not being flexible enough for some use cases which isn't easy to fix without changing swc itself. SWC is deprecated so I don't think we should spend too much time working around issues like this. I made the fallback automatic which doesn't require a new flag, but it does mean the js optimization happens serially before instead of parelell with the other asset optimization |
If any wasm bindgen assets include links to external assets, the swc bundler fails to process them. This PR adds a CLI argument to skip the SWC bundler with wasm bindgen assets and instead hash and optimize the whole folder. The regression test added in the playwright folder has an example of a project that requires this flag. If you use a raw module link in wasm-bindgen and bundle your js asset separately, the swc bundler fails to read the link as a file:
Most bundlers include an option to exclude specific files from the bundling process for external assets, but it looks like swcpack does not support that feature. The SWC bundler is also deprecated and will be removed in the next release so we should start thinking about a migration plan. There is a separate issue discussing other bundlers here: #4449
Fixes #4440