Skip to content

feat(commonjs): expose named data exports from wrapped entries - #2049

Open
businessdeveloper69 wants to merge 2 commits into
rollup:masterfrom
businessdeveloper69:feat/commonjs-named-entry-exports
Open

businessdeveloper69 wants to merge 2 commits into
rollup:masterfrom
businessdeveloper69:feat/commonjs-named-entry-exports

Conversation

@businessdeveloper69

@businessdeveloper69 businessdeveloper69 commented Nov 21, 2026 •

Copy link
Copy Markdown

Rollup Plugin Name: commonjs

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

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Resolves #1885.

Description

With commonjs({ namedExportsForEntries: true }), a wrapped CommonJS entry exposes statically assigned data properties as named ESM exports. Its default export is preserved. A directly defined getter stays on the default object so importing the entry does not evaluate it. The option defaults to false.

Tuta’s Undici build currently adds named exports after bundling. With the option enabled, its consumer imported Agent, fetch and Headers directly and made an HTTP request on Node 22 and 24. I also checked readable-stream 3.6.0 against Node’s native ESM imports, including constructor identity, circular imports and lazy module execution.

The type checks, repository lint, and formatting checks passed.

The cache regression test reuses bundle.cache twice, including after an export changes. Cached builds passed on Rollup 2, 3 and 4. Tuta’s Undici bundle and readable-stream both ran with a cache created by the previous revision. The CommonJS suite passed all 298 tests on Node 20 and 24.

AI assisted.

@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the cached-build failure is fixed, and no new actionable issues were found.

Reviews (2) · Last reviewed commit: "fix(commonjs): handle cached named entry..." · Reviewed by Greptile

Comment thread packages/commonjs/src/proxies.js Resolved
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.

[@rollup/plugin-commonjs] Bring back named exports in commonjs entry points

1 participant