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

Don't use require() in ESM files #12728

Merged
merged 2 commits into from Feb 1, 2021

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Jan 31, 2021

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

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 contained require() 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.

@nicolo-ribaudo nicolo-ribaudo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories Priority: High pkg: standalone labels Jan 31, 2021
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 31, 2021

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:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@babel-bot
Copy link
Collaborator

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",
],
}),
Copy link
Contributor

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?

Copy link
Member Author

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.

@nicolo-ribaudo nicolo-ribaudo merged commit 4f2d475 into babel:main Feb 1, 2021
@nicolo-ribaudo nicolo-ribaudo deleted the fix-require-in-standalone branch February 1, 2021 16:09
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: standalone PR: Bug Fix 🐛 A type of pull request used for our changelog categories Priority: High
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants