Repository navigation
feat(data-uri): support modules imported with import attributes in Rollup 5 - #2064
Open
lukastaegert wants to merge 1 commit into
Open
lukastaegert wants to merge 1 commit into
lukastaegert wants to merge 1 commit into
Conversation
…llup 5 Rollup 5 appends an encoded attributes suffix to module ids. The `load` hook now resolves the cached data URI through the `rawId` it receives, falling back to `id` when the hook is called with a single argument as in Rollup 1-4, so data URIs imported with attributes are decoded instead of being read from disk. The tests bundle a fixture that imports a data URI with attributes and also call `load` directly with a Rollup 5 shaped id alongside a Rollup 1-4 shaped call. `@rollup/pluginutils` is bumped to ^5.6.0 for dependency alignment, not for behaviour: the plugin only uses `dataToEsm`.
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(data-uri): support modules imported..." · 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:
data-uriThis 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.The plugin resolves
data:ids itself and remembers the decoded content in order to return it fromload. Under Rollup 5 theloadhook receives the attribute-encoded id, the lookup missed, and Rollup fell back to reading the id as a file, failing withCould not load data:application/json,...?attributes=... ENOENT.loadnow looks the id up by itsrawId, falling back to the id itself for Rollup 1-4 and other callers that pass no hook options. The attribute tests cover the bundling case and the two-argument hook call.