Skip to content

Clarify barrel loader export map comment#93893

Open
2wndrhs wants to merge 1 commit into
vercel:canaryfrom
2wndrhs:clarify-barrel-loader-export-map-comment
Open

Clarify barrel loader export map comment#93893
2wndrhs wants to merge 1 commit into
vercel:canaryfrom
2wndrhs:clarify-barrel-loader-export-map-comment

Conversation

@2wndrhs
Copy link
Copy Markdown

@2wndrhs 2wndrhs commented May 16, 2026

What?

Clarifies the export map terminology in next-barrel-loader.

The current comment describes the export map format as:

[\"<imported identifier>\", \"<import path>\", \"<exported name>\"]

But for a barrel re-export such as:

export { a as b } from './module-a'

the generated map entry is:

[\"b\", \"./module-a\", \"a\"]

Here, b is the name exported by the barrel file, while a is the original export name from the source module.

Why?

The current wording is ambiguous because the first tuple element is not the source module's original export name. It is the name exported by the barrel file and requested by the user import.

How?

Updates the comment to describe the tuple as:

[\"<barrel export name>\", \"<source module path>\", \"<source export name>\"]

No runtime behavior changes.

Verification

  • cargo test -p next-custom-transforms --test fixture optimize_barrel
  • git diff --check

@2wndrhs 2wndrhs marked this pull request as ready for review May 16, 2026 13:15
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