feat(wasm): support inlining wasm binaries with the ?inline query - #1909
Open
elecmonkey wants to merge 4 commits into
Open
elecmonkey wants to merge 4 commits into
elecmonkey wants to merge 4 commits into
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
elecmonkey
force-pushed
the
elecmonkey/wasm-inline
branch
2 times, most recently
from
September 13, 2026 21:22
e93a071 to
80cadfa
Compare
elecmonkey
marked this pull request as ready for review
September 13, 2026 21:33
elecmonkey
force-pushed
the
elecmonkey/wasm-inline
branch
from
September 14, 2026 03:26
80cadfa to
ebd1d43
Compare
Contributor
|
no documents about inline feature in wasm chapter? |
The resolve hook read an existing issuer query off the request before appending a new one, but appended unconditionally. Requests reaching the hook never carry that query, so drop the fallback.
The inline loader rule was registered regardless of the wasm mode, so `wasm: false` still inlined `?inline` imports while leaving plain `.wasm` imports alone. Skip the rule and keep the original specifiers instead.
Absolute issuer paths ended up in the generated module identifiers of bundleless output, which made builds depend on the source directory.
| const { format } = this.getOptions(); | ||
| if (format !== 'esm') { | ||
| throw new Error( | ||
| `Importing wasm with the "?inline" query only supports the "esm" format, but the current format is "${format}".`, |
Contributor
There was a problem hiding this comment.
Suggested change
| `Importing wasm with the "?inline" query only supports the "esm" format, but the current format is "${format}".`, | |
| `WASM imports with "?inline" require the "esm" format, but the current format is "${format}".`, |
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
Support importing small WebAssembly binaries with
?inlineto embed them directly into JavaScript.The binary is instantiated with top-level
awaitand exposes both named exports and a default export ofinstance.exports. This requires ESM output.In bundleless builds, the binary is embedded into each importing JavaScript file. WebAssembly imports are resolved as module dependencies.