Repository navigation
feat(node-resolve): support modules imported with import attributes in Rollup 5 - #2069
Open
lukastaegert wants to merge 1 commit into
Open
lukastaegert wants to merge 1 commit into
lukastaegert wants to merge 1 commit into
Conversation
…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
marked this pull request as ready for review
December 3, 2026 12:23
Confidence Score: 5/5
[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 |
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:
node-resolveThis PR contains:
Are tests included?
Breaking Changes?
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 onfoo.jsnow seefoo.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: falseempty 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, andloadnever recognised\0node-resolve:empty.jswith a suffix, making Rollup read a path with a null byte.The plugin now resolves with
resolveOptions.importerRawIdand compares the empty module against the raw id inload.@rollup/pluginutilsmoves to ^5.6.0 as in the rest of the series. The three attribute tests cover TypeScript mapping,browser: falseand browser map entries, and fail without the change.