Skip to content
Advertisement

Babel and Webpack are throwing “Can’t resolve ‘regenerator-runtime/runtime'”

I’m working on a browser-based project that needs to be IE11-compatible (sigh). Webpack is choking on async/await. Here is my console’s output:

JavaScript

I’ve looked at many SO questions similar to mine, without luck. Many recommend using @babel/polyfill which I am avoiding since it has been deprecated.

What is causing this issue? I expect it could be fixed by manually importing regenerator-runtime/runtime, but it seems one of the main selling points of babel-env is NOT having to manually import polyfills, so I assume I’m missing a step. Thank you!

Here is what I am attempting to run, which is being imported into another file:

JavaScript

webpack.config.js:

JavaScript

package.json

JavaScript

Advertisement

Answer

Simply running npm i regenerator-runtime fixed it, actually.

With useBuiltIns: 'usage', having all the import statements wasn’t necessary I guess.

¯_(ツ)_/¯

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement