Repository navigation
feat(dynamic-import-vars): support modules imported with import attributes in Rollup 5 - #2065
Open
lukastaegert wants to merge 1 commit into
Open
lukastaegert wants to merge 1 commit into
lukastaegert wants to merge 1 commit into
Conversation
…butes in Rollup 5 Rollup 5 appends an encoded attributes suffix to module ids. The "No files found" error text and the sourcemap file now use the rawId passed to the transform hook instead, so modules imported with import attributes are handled like their plain counterparts. The plugin now requires @rollup/pluginutils ^5.6.0, whose createFilter strips the attributes suffix itself, so the filter keeps taking the hook id. The tests cover the attribute-encoded id together with rawId for both cases and through a real build, and the two-argument hook call that Rollup 1-4 uses.
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. Reviews (1) · Last reviewed commit: "feat(dynamic-import-vars): support modul..." · 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:
dynamic-import-varsThis 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.Filtering is handled by
@rollup/pluginutils5.6.0, whosecreateFilternow strips the attribute suffix, so the plugin depends on that version. Two user-visible strings still used the encoded id: theNo files found in ... when trying to load ... from <id>error and thefilefield of the emitted sourcemap.Both now use the raw id. The tests assert the exact error text and the sourcemap
filename and fail without the change.Note: rewritten dynamic
import()calls still drop import attributes because the plugin works on the originalImportExpressionarguments. That is a pre-existing limitation independent of this change.