question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

babel-polyfill - error Error: only one instance of babel-polyfill is allowed

See original GitHub issue

I’m submitting a bug report

Webpack Version: 1.14.0

Babel Core Version: 6.23.1

Babel Loader Version: 6.3.2

Please tell us about your environment: Windows 10

Current behavior: I try to use babel-polyfill for ie11 with webpack

entry: {
    app: ['babel-polyfill','./src/main.js']
}

After ie11 reconize Array.includes but in some pages i have error in other browsers like Firefox error Error: only one instance of babel-polyfill is allowed

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:13
  • Comments:25 (4 by maintainers)

github_iconTop GitHub Comments

133reactions
lipematcommented, Feb 6, 2019

There was another 3rd party library which included the babel-polyfill in their bundle. To fix this I had to remove the babel-polyfill from the entry in webpack.config and add a conditional require to the top of my index.js which is the entry point.

Before webpack.config:

module.exports = {
	entry : [
		'babel-polyfill', './src/index'
	]
}

After webpack.config:

module.exports = {
	entry : [
		'./src/index'
	]
}

Added to the top of ./src/index.js:

if (!global._babelPolyfill) {
	require('babel-polyfill');
}

Now everything works without issue.

27reactions
swarajbancommented, Jun 16, 2017

I was also seeing this error, but after checking my html, I was also including my bundled JS twice. Fixed by updating my HTML to ensure I only include my bundle once

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Only one instance of babel-polyfill is allowed" error
Looks like the culprit is HtmlWebpackPlugin in my webpack config. If I remove this plugin, I the error goes away. · try changing...
Read more >
Uncaught Error: only one instance of babel-polyfill is allowed
On a site with a theme that uses webpack and babel (with no issue), once Oasis Workflow is activated an error is thrown...
Read more >
Error: only one instance of babel-polyfill is allowed
After adding genomelink node module to my app and I have this error. Please recommend a way to fix this.
Read more >
only-one-instance-of-babel-polyfill-allowed-error
VS Code's tsserver was deleted by another application such as a misbehaving virus detection tool. Please reinstall VS Code. Manage Extension.
Read more >
Only one instance of babel-polyfill is allowed" error-Reactjs
[Solved]-"Only one instance of babel-polyfill is allowed" error-Reactjs ... I had the same issue and I get rid of the error by removing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found