How to add babel-polyfill
See original GitHub issueI’m using redux-saga
in my gatsby app and therefore generator functions. These are causing errors in IE11 and it seems like babel isn’t polyfilling them. I’ve been trying different techniques for including babel-polyfill
but none seem to work, both of these seem relevant but don’t solve my issue:
https://github.com/gatsbyjs/gatsby/issues/341 https://github.com/gatsbyjs/gatsby/issues/2177
I’m trying to do the following, but still having the same error in IE. Is there a preferred approach for solving this?
if ( stage === 'build-javascript' || stage === 'develop' ) {
config._config.entry.commons.unshift( 'babel-polyfill' );
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
babel/polyfill
To include the polyfill you need to require it at the top of the entry point to your application. Make sure it is...
Read more >@babel/polyfill - npm
Start using @babel/polyfill in your project by running `npm i ... See the @babel/polyfill docs ... Install. npm i @babel/polyfill ...
Read more >How do I install the babel-polyfill library? - Stack Overflow
babel -polyfill allows you to use the full set of ES6 features beyond syntax changes. This includes features such ...
Read more >BabelJS - Babel Polyfill - Tutorialspoint
Babel Polyfill adds support to the web browsers for features, which are not available. Babel compiles the code from recent ecma version to...
Read more >Babel Polyfills - GitHub
A set of Babel plugins that enable injecting different polyfills with different strategies in your compiled code. Additionally, this repository contains a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In the very top of my gatsby-browser.js file i have
is the very first line in that file.
Then in gatsby-node.js I added ‘transform-regenerator’
The ‘transform-decorators-legacy’ is not needed. Just showing you the exact working copy I use.
IE 11 and Edge work fine with Redux-Saga now, Saga uses generators for their side-effects.
Hope this helps.
Are you trying to require
babel-polyfill
? Or add it to the babel config?For the 1st, require it in your layouts/index.js file or gatsby-browser.js.
For the later, add it to a .babelrc in the root of your site.