Skip to content

fix(core): reject numeric source export conditions - #2053

Open
lanqing431 wants to merge 1 commit into
web-infra-dev:mainfrom
lanqing431:fix-validate-source-export-conditions
Open

lanqing431 wants to merge 1 commit into
web-infra-dev:mainfrom
lanqing431:fix-validate-source-export-conditions

Conversation

@lanqing431

Copy link
Copy Markdown

Motivation

With exports.source: "0", Rslib builds successfully but writes a numeric condition key to package.json. Node.js then rejects the generated exports with ERR_INVALID_PACKAGE_CONFIG, even on a normal import that would have used the fallback.

Changes

Reject condition keys that Node's package exports resolver rejects before writing the generated metadata. The error identifies exports.source and gives an example of a valid name. Regression cases cover zero, fractional keys, and the numeric boundary while preserving valid custom conditions.

Validation: pnpm build, pnpm check, pnpm check-spell, 269 unit tests, 436 integration tests, and 7 browser E2E tests passed on Windows. A real CLI build now rejects invalid keys without rewriting the manifest, and packages with valid keys still load in Node.js. The separate cross-platform executable suite timed out in two cases while downloading Node archives.

This branch has not been deployed

No deployments
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