Hope to get some help with following:
The problem
@babel/polyfill causes error in IE11:
SCRIPT1010: Expected identifier
Debugger point on the line:
if (delegate.iterator.return) {
in the function maybeInvokeDelegate()
in regenerator-runtime
plugin.
But
Problem occures only in test environment. When I run my aplication locally, with exactly same build, same browser it works just fine. It contains same code, but it doesn't break anything.
What I've already tried:
babel-plugin-transform-member-expression-literals doesn't seem to help.
I tried to replace @babel/polyfill with only necessary polyfills but I failed. To much errors breaking application which are hard to catch/debug/understand.
Set
useBuiltIns: "usage"
in.babelrc
but faced a problem with way it imports necessary modules. I'm going to give this one more try.I looked through all same issues with regeerator-runtime and babel-polyfill on github, but haven't found working solution.
Config
At the moment I'm requiring @babel/polyfill in webpack config and use it as an entry point. I believe I don't even need regenerator-runtime, because as far as I understand it used for async function (maybe I'm mistaken) and we don't use them.
I'm not using babel loader for webpack but run babel for /dist
directory after webpack.
My babelrc:
{
plugins: ["transform-member-expression-literals"],
presets: [
[ "@babel/preset-env",
{
useBuiltIns: "entry",
modules: "false",
targets: {
ie: 11
}
}]
]
}
webpack.config
require("@babel/polyfill")
const getDefaultConfig = env => ({
mode: "development",
entry: ["whatwg-fetch", "@babel/polyfill", "./src/index.js"],
... })
I have updated all babel packages to latest versions.
Appreciate any help or ideas.
Take a look at the link below
github.com/facebook/create-react-app/issues/4255