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

Updates @babel/plugin-syntax-dynamic-import core-js module paths (core-js@3) #2037

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/plugin-syntax-dynamic-import.md
Expand Up @@ -44,8 +44,12 @@ Currently, `@babel/preset-env` is unaware that using `import()` with [Webpack re
// webpack config
const config = {
entry: [
// using core-js@2
"core-js/modules/es.promise",
Copy link
Member

Choose a reason for hiding this comment

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

This is already for core-js@3: core-js@2 uses es6. instead of es..

Also, those files exist in core-js@3: https://unpkg.com/[email protected]/modules/

Copy link
Author

Choose a reason for hiding this comment

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

I was seeing module resolution errors with the (internal) modules/ based paths after swapping the configuration over to core-js@3 and found swapping to the /stable/ variants to be the solution.

Something else could certainly be the cause of the resolution error if the es. version is supported... sounds like this change shouldn't be necessary?

"core-js/modules/es.array.iterator",
// or using core-js@3
"core-js/stable/promise",
"core-js/stable/array/iterator",
path.resolve(__dirname, "src/main.js"),
],
// ...
Expand All @@ -55,9 +59,13 @@ const config = {
or

```js
// src/main.js
// core-js@2 src/main.js
import "core-js/modules/es.promise";
import "core-js/modules/es.array.iterator";

// core-js@3 src/main.js
import "core-js/stable/promise";
import "core-js/table/array/iterator";

// ...
```