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
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/50326/ |
0b107fc
to
3c8586b
Compare
3c8586b
to
e3ccc40
Compare
TODO: This should be removed in the future.
e3ccc40
to
d22fab8
Compare
}, | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./package.json": "./package.json" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Should we begin to ship exports
for those packages with only a single ./lib/index.js
?
We would have to expose:
I think it's easier to leave it as-is. |
In Babel 8 we will want to use
"exports"
in every package, to prevent people from relying on our internal files. This PR uses a new feature of http://github.com/nicolo-ribaudo/yarn-plugin-conditions/ to specify"exports"
when publishing with theBABEL_8_BREAKING
flag (and for our internal development), but to remove it when publishing Babel 7 releases.I also unified the different
"exports"
we already had for some Babel 7 packages, by making them expose both".": "./lib/index.js"
and"./package.json"
(some already did, some didn't) since it's useful when usingrequire.resolve
to get the package root, or to get metadata such as the plugin version.The commits prefixed with
RUN
are not created manually, but by runningyarn constraints --fix
with the constraints introduced by the previous commit.