feat(wasm): support wasm modules in ESM output with compile and preserve modes#1726
Open
elecmonkey wants to merge 5 commits into
Open
feat(wasm): support wasm modules in ESM output with compile and preserve modes#1726elecmonkey wants to merge 5 commits into
elecmonkey wants to merge 5 commits into
Conversation
Cover compile/preserve modes across bundle and bundleless builds.
Deploying rslib with
|
| Latest commit: |
012cf20
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e6214e9a.rslib.pages.dev |
| Branch Preview URL: | https://feat-wasm-phase-1.rslib.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a
wasmlibrary option to control how.wasmmodules are handled in ESM output.wasm.mode:'compile'— Rspack parses the.wasmmodule and generates the JS glue and runtime to load it.'preserve'— keep.wasmas a real ESM import and emit the binary. In bundle mode the binary is emitted as a content-hashed asset; in bundleless mode it keeps the source-relative path and original filename.When
modeis unset, it defaults to'compile'forbundle: trueand'preserve'forbundle: false. The option is only effective forformat: 'esm'.Includes integration tests covering compile/preserve × bundle/bundleless, and a new WebAssembly guide (EN + ZH) documenting the modes, supported import forms (static, dynamic,
import source,import.source()), andwasm-bindgenusage.Checklist