Skip to content

feat(legacy): support modules imported with import attributes in Rollup 5 - #2068

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

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

Conversation

@lukastaegert

Copy link
Copy Markdown
Member

Rollup Plugin Name: legacy

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.

The plugin decides whether a module is a legacy entry by looking the id up in its normalized exports map. With the encoded id the lookup missed, so no exports were added for attributed entries, silently.

The lookup now uses the raw id. @rollup/pluginutils is bumped to ^5.6.0 to match the rest of the series, though this package only uses normalizePath. The test bundles an entry imported with attributes and fails without the change.

…up 5

Rollup 5 appends an encoded attributes suffix to module ids. The exports map is now looked up with the rawId passed to the transform hook instead, so modules imported with import attributes are handled like their plain counterparts.
The tests pass the attribute-encoded id together with rawId and also cover the two-argument hook call that Rollup 1-4 still uses.
Bumping @rollup/pluginutils to ^5.6.0 keeps the dependency in line with the other Rollup 5 support PRs.
@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(legacy): support modules imported w..." · 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