Repository navigation
feat(wasm): support rollup 5 - #2047
Merged
Merged
Conversation
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; no new actionable issues were found.
|
There was a problem hiding this comment.
🟡 Changes recommended
Rollup 5.0.0-2 requires Node >=22.22.0, but CI still runs the Wasm build and tests on Node 20, leaving those jobs on an unsupported runtime.
2 open issues
1 file not reviewed
pnpm-lock.yaml: Generated file
What changed in this PR
Adds Rollup 5 compatibility to the Wasm plugin, addressing attribute-encoded module IDs while retaining fallback behavior for earlier Rollup versions.
Changes:
- Uses
rawIdfor filtering, file access, sync matching, and emitted-asset tracking. - Adds import-attribute tests and disables tree-shaking in environment-specific tests.
- Extends the Rollup peer range and selects Rollup 5 for development.
| File | Description |
|---|---|
pnpm-workspace.yaml |
Adds the shared Rollup 5 development catalog. |
pnpm-lock.yaml |
Locks Rollup 5 and its dependency resolutions. |
packages/wasm/test/test.mjs |
Tests attributed imports and asset deduplication; adjusts environment tests. |
packages/wasm/test/fixtures/attributes.js |
Exercises execution of an attributed Wasm import. |
packages/wasm/test/fixtures/attributes-and-plain.js |
Imports one Wasm file with and without attributes. |
packages/wasm/src/index.ts |
Handles attributed module IDs through rawId. |
packages/wasm/package.json |
Declares Rollup 5 support and updates the development dependency. |
Review effort: Balanced
3 of 9 tasks
lukastaegert
force-pushed
the
wasm-rollup-5
branch
from
November 28, 2026 05:53
984882d to
5560a1a
Compare
Rollup 5 encodes import attributes into the module id, so the load and transform hooks received ids like `sample.wasm?attributes=...` and rejected the module, after which Rollup tried to parse the binary as JavaScript. The hooks now use the `rawId` they receive for the extension check, the file access, the watched file, the emitted file name and the asset and sync lookups, so the plain and attributed variants of a module share one asset. The include/exclude filter relies on `@rollup/pluginutils` ^5.6.0, which strips the attribute suffix before matching, and the peer range is extended to Rollup 5. Two build tests cover loading a `.wasm` module imported with attributes and that importing it with and without attributes emits a single asset which both variants load from. Both are skipped below Rollup 5, where ids carry no attributes.
lukastaegert
force-pushed
the
wasm-rollup-5
branch
from
December 3, 2026 13:21
5560a1a to
a451754
Compare
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.


Rollup Plugin Name:
wasmThis PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
Rollup 5 makes import attributes part of module identity, so the id of an attributed import is the file path with an encoded
?attributes=...suffix. As the plugin matched ids with/\.wasm$/andcreateFilter, attributed Wasm imports were never loaded or transformed, and Rollup tried to parse the binary as JavaScript.The
loadandtransformhooks now use therawIdoption for the extension check, the file access, the watched file, the emitted file name and the asset and sync lookups, falling back to the id for earlier Rollup versions that do not pass it. Keying assets by the raw id keeps a single emitted file when the same Wasm is imported with different attributes.The include/exclude filter relies on
@rollup/pluginutils^5.6.0, which strips the attribute suffix before matching. The peer range is extended to Rollup 5 and the package tests againstrollup@5.0.0-5through therollup-nextcatalog.The attributes build test uses an
includepattern, so it also covers that filtering works on attributed ids — which it only does because@rollup/pluginutils5.6.0 strips the suffix before matching. Both new build tests are skipped below Rollup 5, where ids carry no attributes.