-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[preset-env] all the core-js imports are removed #12545
[preset-env] all the core-js imports are removed #12545
Comments
Hey @ertrzyiks! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
We could use this to handle both the cases: getModulePath(modules[0]) === source || getModulePath(modules[0]) === `${source}.js` I'm marking this as a good first issue since it shouldn't be too hard to fix it, but it gives the opportunity to setup the repo and learn how our tests work, and fixing it has a good impact since currently the whole If it is the first time that you contribute to Babel, follow these steps: (you need to have
|
Thanks @nicolo-ribaudo , I can work on a PR tomorrow morning |
Thanks! 🧡 |
I narrowed it down even further. In the demo I show it breaks when used with presets: [
[require('@babel/preset-env').default, { corejs: 3, useBuiltIns: 'entry' }],
[require('babel-preset-react-app/node_modules/@babel/preset-env').default, { corejs: 3, useBuiltIns: 'entry' }],
] so we have two different versions of the preset applied. => Found "@babel/[email protected]"
info Has been hoisted to "@babel/preset-env"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "216KB"
info Disk size with unique dependencies: "3.9MB"
info Disk size with transitive dependencies: "20.1MB"
info Number of shared dependencies: 84
=> Found "babel-preset-react-app#@babel/[email protected]"
info This module exists because "babel-preset-react-app" depends on it.
info Disk size without dependencies: "1.02MB"
info Disk size with unique dependencies: "4.7MB"
info Disk size with transitive dependencies: "20.9MB"
info Number of shared dependencies: 84 I'm not sure how to write a good regression test for this case. |
I've submitted a PR with just the code change. I tried to write a regression test but it works properly when only one version of the preset is used. I'm open for suggestions on how to approach it. If you think it makes sense to add a specific version of the preset to the dependencies and have a test anyway, I can try to make it happen. Also, that change broke some other scenarios, so I'm not sure if I'm looking at the correct place. Need more digging. Edit: I think the breaking scenarios are valid without the extension, so 👌 |
You need to pass |
I have the lates Node JS and NPM version, in theory shouldn't be any trouble with this, but idk what is failed on my configuration... |
Currently |
He does because I’m taking it off a MEVN course at Udemy and upgrading to ES6 with Babel, precisely. |
If you want I can invited you to my GitHub repository, to you can work with me, fixing this trouble? |
Is this issue still prevailing? Can I work onit? |
Is this problem still occurring? Can I work on it? (I'm looking for a good first question to work on) |
Bug Report
Current behavior
No core-js polyfills in the final bundle.
Since #10862 the core-js polyfill paths always have
.js
extension.In
shouldReplace
functionbabel/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js
Lines 52 to 64 in 4108524
the module path is compared with the source. In my application the comparison happens between
core-js/modules/es.symbol
andcore-js/modules/es.symbol.js
causing the function to return different value than expected.Input Code
Expected behavior
Importing core-js includes polyfill to the final bundle
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
babel.config.js
Environment
Possible Solution
Make the comparison ignore module path extension. My application compiles correctly if I alter the condition to exclude the extension. (note hardcoded string slice)
The text was updated successfully, but these errors were encountered: