Skip to content

fix(babel): support modules imported with attributes in Rollup 5 - #2075

Open
lukastaegert wants to merge 1 commit into
masterfrom
fix/babel-rawid
Open

lukastaegert wants to merge 1 commit into
masterfrom
fix/babel-rawid

Conversation

@lukastaegert

@lukastaegert lukastaegert commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Rollup Plugin Name: babel

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes
  • no

Breaking Changes?

  • yes
  • no

List any relevant issue numbers:

#2037

Description

This is a follow-up to the previous rollup-5 compatibility PR #2039 as we found more places that should be adjusted.

babelOptions.filename and the user include/exclude filter were evaluated against the encoded id, so Babel resolved its configuration and reported errors for a file that does not exist, and **/*.js include patterns did not match attributed modules.

The filter now relies on @rollup/pluginutils 5.6.0, whose createFilter strips the attribute suffix (the package depends on that version), and the compiler receives the raw id as filename. The helper injection still uses the composite id, since it must match the module Rollup created.

The tests assert the filename Babel receives during a build of a module imported with attributes and that an include pattern matches it; both fail without the change.

Rollup 5 appends an encoded attributes suffix to module ids. The compiler file name and sourcemap paths now use 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 2-4 still uses.
The plugin now requires @rollup/pluginutils ^5.6.0, whose createFilter strips the attributes suffix before matching.
@lukastaegert
lukastaegert marked this pull request as ready for review December 3, 2026 12:09
@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: "fix(babel): support modules imported wit..." · 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