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
Don't use require()
in ESM files
#12728
Don't use require()
in ESM files
#12728
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 72d89fd:
|
05413e8
to
72d89fd
Compare
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/39059/ |
"packages/babel-compat-data/*.js", | ||
"packages/*/src/**/*.cjs", | ||
], | ||
}), |
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: Does the plugin reordering here resolve rollup/plugins#557?
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.
Yes, I don't get any error now. Btw, I swapped them because it's documented at https://github.com/rollup/plugins/tree/master/packages/babel#using-with-rollupplugin-commonjs
This means that we cannot use flow/TS in cjs files, but I couldn't find another way to make it work.
This PR fixes a regression introduced by #12677.
Since
require
is a normal function in ES modules,rollup
doesn't resolve it and thus the@babel/standalone
bundle still containedrequire()
calls.This needs to be merged before the next release.
The first commit updates
yarn-plugin-conditions
, because nicolo-ribaudo/yarn-plugin-conditions@5b39955 makes it more bundler-friendly.