Skip to content

feat(node-resolve): support modules imported with import attributes in Rollup 5 - #2069

Open
lukastaegert wants to merge 1 commit into
masterfrom
feat/rollup-5/node-resolve
Open

lukastaegert wants to merge 1 commit into
masterfrom
feat/rollup-5/node-resolve

Conversation

@lukastaegert

Copy link
Copy Markdown
Member

Rollup Plugin Name: node-resolve

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes
  • no

Breaking Changes?

  • yes
  • no

List any relevant issue numbers:

#2037

Description

Rollup 5 appends an encoded ?attributes=... suffix to the id of every module imported with import attributes, so hooks that ran on foo.js now see foo.js?attributes=%7B%22type%22%3A%22json%22%7D.

Two id-shaped values reach resolution: the importer passed into the resolver and the id compared against the browser: false empty module. Under Rollup 5 the importer carries the attribute suffix, so package info, browser map entries and the \.(ts|mts|cts|tsx)$ check were evaluated against the encoded path, and load never recognised \0node-resolve:empty.js with a suffix, making Rollup read a path with a null byte.

The plugin now resolves with resolveOptions.importerRawId and compares the empty module against the raw id in load. @rollup/pluginutils moves to ^5.6.0 as in the rest of the series. The three attribute tests cover TypeScript mapping, browser: false and browser map entries, and fail without the change.

…n Rollup 5

Rollup 5 appends an encoded attributes suffix to module ids. The load and resolve hooks now use the rawId/importerRawId they receive for the empty-module comparison, browser map caches and extension tests, so modules imported with import attributes resolve like their plain counterparts.
The tests build the same fixtures with attributed imports and are skipped before Rollup 5, which does not encode attributes into ids.
As createFilter in @rollup/pluginutils 5.6.0 strips the attribute suffix itself, the plugin now requires @rollup/pluginutils ^5.6.0.
@lukastaegert
lukastaegert marked this pull request as ready for review December 3, 2026 12:23
@greptile-apps

greptile-apps Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Reviews (1) · Last reviewed commit: "feat(node-resolve): support modules impo..." · Reviewed by Greptile

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