-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Do I need to import @babel/polyfill? #1963
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
Comments
If you use webpacker v3 (and therefore babel 6) you need to When you switch to webpacker v4, you need to switch to The polyfill works that way, that babel will replace the Does importing |
Thanks for the explanation. That's already helping :) I wasn't importing When I add |
Hmm, hard to tell without knowing the setup. If you use something like source-map-explorer on your generated file (& sourcemap) you should be able to see core.js (especially If this is true with and without With babel-preset-env (which you are using), babel replaces the import of babel-polyfill with the require statements that you need for your bundle and browser env configuration: https://babeljs.io/docs/en/babel-preset-env#usebuiltins-entry (this is for babel 7, you are using babel 6, but I think it is still valid) So in your case babel transpiles
to
This is my understanding, which I just got yesterday when upgrading to webpacker v4. I hope it helps =) |
This sounds plausible though I'm not sure how to prove it. Anyway, I think the answer to my original question is yes. Thanks, Paul, for your help! |
Figured I'd post here in case anyone finds this via google - it looks like @babel/polyfill is now depreciated in favor of core-js. |
Thank you for posting this. More info in the PR #2031 |
Hello!
I'm using Webpacker 3.5.5. I write ES6 JavaScript code and I want it to work on evergreen browsers and IE11.
In my
.babelrc
I am targetting browsers which include IE11:However on IE11 I get the error:
ReferenceError: 'Symbol' is undefined
.On the ES6 wiki page, it says:
However when I switch on webpacker's debug output, it seems to be generating lots of polyfills. Do I need to
import "@babel/polyfill"
in addition to my browser list setting in.babelrc
?Also, the wiki page mentions:
I don't have
babel.config.js
. Does that matter?Many thanks in advance!
The text was updated successfully, but these errors were encountered: