-
Notifications
You must be signed in to change notification settings - Fork 811
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
Promise not defined in IE 11 #436
Comments
I think you'd need the Polyfill Babel plugin for this. https://babeljs.io/docs/usage/polyfill/ Can someone confirm this? Should we add it to Mix's .babelrc out of the box? |
Babel polyfill fixed it. I'm not using Promise myself, but its one of the packages i am importing. Mix should run on all those too right?
|
Yes, you can simply include It may be reasonable though to provide promise polyfill and, maybe, object-assign, out of the box. For example, this is the snippet from CRA that achieves this exact thing:
This example is particularly good, because it enables rejection tracking. UPD: In short, I don't think encouraging the use of |
fwiw I always just use https://polyfill.io/ If any polyfills are going to be added by default to laravel-mix, I'd suggest providing a way to opt out of their inclusion. |
I created a small plugin for injecting polyfills. My motivation to do so:
The result is |
Thanks, everyone. Going to close this, since there are a number of solutions it seems. |
I had this issue even with adding babel-polyfill, because of a bug with webpack 2.6.0. Upgrading to 2.6.1 solved the issue. |
@SebastianS90 I know Mix isn't running on Webpack 4 yet, but is there a way to have your webpack-polyfill-injector package work with Mix for either version 1.0.2 or 2+? I started using it due to your comment here, and am still stuck on v0.0.4 due to not being able to get the later versions working with Mix. |
Just a quick update for anyone finding this issue in 2020: as of babel 7.4.0 babel-polyfill has been deprecated in favor of core-js: At the top of your main js file add the following:
This adds about 26kb (9kb gzipped) to yuor bundle size — or if you want the entire suite of polyfills, you can just |
node -v
): 6.9.2npm -v
): 412Description:
Getting
Promise is not defined
in IE 11. Does babel not convert this by default? Where do i add the needed config to polyfill Promise?The text was updated successfully, but these errors were encountered: