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

Add support for native esm to @babel/runtime #10748

Merged
merged 4 commits into from Nov 22, 2019

Conversation

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Nov 21, 2019

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

Currently esm/ helpers are broken: when you try to natively import them, they are parsed as scripts and thus throw an error.

Assing type: module is a better fix than renaming the files to *.mjs, because this isn't a breaking change.

I only tested this PR manually because:

  1. Babel can't be built on Node 13.2 which supports unflagged modules (nodejs/node#30581)
  2. Jest doesn't support native modules
@nicolo-ribaudo nicolo-ribaudo force-pushed the nicolo-ribaudo:helpers-native-esm branch from eb4fe0c to ff7662c Nov 22, 2019
rm -rf packages/babel-runtime-corejs2/helpers
rm -f packages/babel-runtime/helpers/**/*.js
rm -f packages/babel-runtime-corejs2/helpers/**/*.js
rm -f packages/babel-runtime-corejs3/helpers/**/*.js
rm -rf packages/babel-runtime-corejs2/core-js

This comment has been minimized.

Copy link
@JLHwung

JLHwung Nov 22, 2019

Contributor

nit: I think we should also clean packages/babel-runtime-corejs3/core-js(-stable)?.

Copy link
Contributor

JLHwung left a comment

In order to fix #8462, we still need #10548 which generates explicit extension for ESM imports.

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member Author

nicolo-ribaudo commented Nov 22, 2019

@JLHwung Why isn't the package.json enough?

@nicolo-ribaudo nicolo-ribaudo merged commit 1b4cfc2 into babel:master Nov 22, 2019
3 of 5 checks passed
3 of 5 checks passed
Travis CI - Pull Request Build Errored
Details
test262 Workflow: test262
Details
codecov/project 88.15% (target 80%)
Details
e2e Workflow: e2e
Details
test Workflow: test
Details
@nicolo-ribaudo nicolo-ribaudo deleted the nicolo-ribaudo:helpers-native-esm branch Nov 22, 2019
@jaydenseric

This comment has been minimized.

Copy link

jaydenseric commented Nov 23, 2019

@nicolo-ribaudo native ESM in Node.js requires the file extension to be in the import specifier:

https://nodejs.org/api/esm.html#esm_mandatory_file_extensions

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member Author

nicolo-ribaudo commented Nov 23, 2019

Thanks, I reopened the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.