Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[babel 8] Add "exports" to every package #14013

Merged
merged 9 commits into from
Dec 29, 2021
1 change: 1 addition & 0 deletions constraints.pro
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,6 @@ gen_enforced_field(WorkspaceCwd, 'exports', '{ ".": "./lib/index.js", "./package
WorkspaceIdent \= '@babel/eslint-parser',
WorkspaceIdent \= '@babel/compat-data',
WorkspaceIdent \= '@babel/plugin-transform-react-jsx', % TODO: Remove in Babel 8
WorkspaceIdent \= '@babel/helper-plugin-test-runner', % TODO: Remove in Babel 8
WorkspaceIdent \= '@babel/standalone',
\+ atom_concat('@babel/runtime', _, WorkspaceIdent).
14 changes: 9 additions & 5 deletions packages/babel-helper-plugin-test-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@
"author": "The Babel Team (https://babel.dev/team)",
"conditions": {
"BABEL_8_BREAKING": [
null,
{
"exports": {
".": {
"import": "./esm.mjs",
"default": "./lib/index.js"
},
"./package.json": "./package.json"
}
},
{
"exports": null
}
]
},
"exports": {
".": "./lib/index.js",
"./package.json": "./package.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Why should we move the exports to conditions if-else? I perceive that it is to use Babel 7 export-less package.json but don't know what is breaking. I expect every package will eventually come with top level exports, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I removed this because the file already contains a complex "exports" that lets it work in Babel 7 while also having an ESM entry point. The exports in BABEL_8_BREAKING are a simpler version of what this package already has (you can see it by expanding the diff).

This exports I deleted here was auto-generated by yarn constraints --fix while we didn't have the other exports yet, then I rebased and had to delete it to remove the "conflict".

}
}