feat(wasm): add webcontainer fallback#11526
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds WebContainer support to rspack by implementing a fallback mechanism that automatically downloads and uses the WASM binding when running in StackBlitz WebContainer environments. This is a temporary solution copied from rolldown/oxc until StackBlitz configures automatic substitution for rspack.
- Adds webcontainer-fallback.cjs that detects WebContainer environment and downloads the WASM binding
- Updates package.json to include the fallback file in the distribution
- Modifies binding.js to use the WebContainer fallback when no native binding is available
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/node_binding/webcontainer-fallback.cjs | New fallback script that downloads and loads WASM binding in WebContainer |
| crates/node_binding/package.json | Adds webcontainer-fallback.cjs to files array |
| crates/node_binding/binding.js | Adds WebContainer detection and fallback loading logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Performance ReportMerging #11526 will not alter performanceComparing 🎉 Hooray!
|
📦 Binary Size-limit
❌ Size increased by 512bytes from 47.62MB to 47.62MB (⬆️0.00%) |
Summary
Copy from rolldown/oxc. This is a temporary solution before stackblitz configures the auto substitution for rspack. There's no need to specify architecture in webcontainer, see https://rspack.rs/guide/start/quick-start#preview-with-stackblitz
Checklist