Skip to content

feat(wasm): support wasm files imported with import attributes in Rollup 5 - #2053

Closed
TrickyPi wants to merge 1 commit into
rollup:masterfrom
TrickyPi:feat/rollup-5/wasm
Closed

TrickyPi wants to merge 1 commit into
rollup:masterfrom
TrickyPi:feat/rollup-5/wasm

Conversation

@TrickyPi

@TrickyPi TrickyPi commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Rollup Plugin Name: wasm

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

In Rollup 5, import attributes are appended to id as a query string, with the original ID passed via rawId. Use loadOptions.rawId and transformOptions.rawId (falling back to id) so .wasm files imported with import attributes are handled properly.

@TrickyPi
TrickyPi requested a review from shellscape as a code owner November 22, 2026 04:51
@greptile-apps

greptile-apps Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches wasm imports handled by this plugin.

The PR appears safe to merge, with a non-blocking request to cover the other changed loading paths.

Findings

  1. P2 Other loading paths lack coverage ▶

Reviews (1) · Last reviewed commit: "fix(wasm): handle wasm files imported wi..." · Reviewed by Greptile

Comment on lines +33 to +36
const plugin = wasmPlugin();
const binary = await plugin.load.call({ addWatchFile() {} }, id, { rawId });
const { code } = plugin.transform.call({}, binary, id, { rawId });
expect(code).toContain('_loadWasmModule(0, null, ');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Other loading paths lack coverage

The new test only checks default inline loading. It never reaches the changed copies[rawId], filename, or syncFiles branches, so mistakes there can pass unnoticed. Add attributed-import cases with maxFileSize: 0 and with sync set. Check that the first emits and references the expected asset, while the second stays inline and generates a synchronous loader.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@TrickyPi TrickyPi changed the title fix(wasm): handle wasm files imported with import attributes in Rollup 5 feat(wasm): support wasm files imported with import attributes in Rollup 5 Nov 22, 2026
@TrickyPi

TrickyPi commented Nov 22, 2026 •

Copy link
Copy Markdown
Member Author

Missed #2047, closing in favor of that!

@TrickyPi TrickyPi closed this Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant