Skip to content

feat(image): support images imported with import attributes in Rollup 5 - #2052

Merged
lukastaegert merged 2 commits into
rollup:masterfrom
TrickyPi:feat/rollup-5/image
Dec 4, 2026
Merged

lukastaegert merged 2 commits into
rollup:masterfrom
TrickyPi:feat/rollup-5/image

Conversation

@TrickyPi

@TrickyPi TrickyPi commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Rollup Plugin Name: image

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 (falling back to id) in load so images imported with import attributes are matched and read properly.

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

greptile-apps Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

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

Reviews (9) · Last reviewed commit: "Merge branch 'master' into feat/rollup-5..." · Reviewed by Greptile

@TrickyPi TrickyPi changed the title fix(image): read images imported with import attributes in Rollup 5 feat(image): support images imported with import attributes in Rollup 5 Nov 22, 2026
@TrickyPi
TrickyPi requested a review from shellscape as a code owner November 22, 2026 06:39
Comment thread packages/image/package.json Resolved
@TrickyPi
TrickyPi force-pushed the feat/rollup-5/image branch 2 times, most recently from ff90310 to a9be05d Compare November 28, 2026 08:53
@TrickyPi TrickyPi mentioned this pull request Nov 28, 2026
3 of 9 tasks
Rollup 5 appends an encoded attributes suffix to the id of a module imported with attributes, so the extension lookup found no MIME type, the image was never loaded, and the include/exclude patterns stopped matching.

The load hook now uses the `rawId` it receives for the extension lookup, `addWatchFile` and `readFileSync`. The include/exclude filter keeps the composite id, because `@rollup/pluginutils` ^5.6.0 strips the attribute suffix before matching.

The test bundles a module that imports an SVG with attributes and asserts that the image is inlined as a data URI; it is skipped below Rollup 5.
@lukastaegert
lukastaegert merged commit 166cfa9 into rollup:master Dec 4, 2026
6 checks passed
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.

2 participants