Skip to content

feat(virtual): support virtual modules imported with import attributes in Rollup 5 - #2054

Merged
lukastaegert merged 1 commit into
rollup:masterfrom
TrickyPi:feat/rollup-5/virtual
Dec 4, 2026
Merged

lukastaegert merged 1 commit into
rollup:masterfrom
TrickyPi:feat/rollup-5/virtual

Conversation

@TrickyPi

@TrickyPi TrickyPi commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Rollup Plugin Name: virtual

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 module IDs as a query string, with the original IDs passed via importerRawId and rawId. Use resolveOptions.importerRawId in resolveId and loadOptions.rawId in load (falling back to importer / id).

@TrickyPi
TrickyPi requested a review from shellscape as a code owner November 22, 2026 04:52
@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 defects were found.

Reviews (8) · Last reviewed commit: "feat(virtual): support virtual modules i..." · Reviewed by Greptile

Comment thread packages/virtual/test/test.js Resolved
@TrickyPi TrickyPi changed the title fix(virtual): handle virtual modules imported with import attributes in Rollup 5 feat(virtual): support virtual modules imported with import attributes in Rollup 5 Nov 22, 2026
@TrickyPi
TrickyPi force-pushed the feat/rollup-5/virtual branch 2 times, most recently from efb854f to d77bac6 Compare November 28, 2026 08:53
@TrickyPi TrickyPi mentioned this pull request Nov 28, 2026
3 of 9 tasks
@lukastaegert
lukastaegert force-pushed the feat/rollup-5/virtual branch from d77bac6 to 51c8d79 Compare December 3, 2026 16:23
…s in Rollup 5

Rollup 5 appends an encoded attributes suffix to the id of a module that is imported with attributes, so `load` no longer matched the id of the virtual module and the bundle failed with a missing module.

The load hook now looks the module up through the `rawId` it receives. Relative imports inside virtual modules needed no change: Rollup also passes `importerRawId` to `resolveId`, but the encoded suffix contains no path separator, so the directory derived from the composite importer is the same.

The type test compiles against rollup 5's declarations, which reference `Buffer` next to `Symbol.asyncDispose`, so it now includes the node types the repository root already provides. The bundle test imports virtual modules with attributes and is skipped below Rollup 5.

# Conflicts:
#	pnpm-lock.yaml
@lukastaegert
lukastaegert force-pushed the feat/rollup-5/virtual branch from 51c8d79 to 299abc0 Compare December 4, 2026 12:42
@lukastaegert
lukastaegert merged commit 925ea78 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