
Question:
Hope to get some help with following:
<h2><strong>The problem</strong></h2>@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.
<strong>But</strong>
Problem occures <strong>only in test environment</strong>. 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.
<h2><strong>What I've already tried:</strong></h2> <ol><li><a href="https://babeljs.io/docs/en/next/babel-plugin-transform-member-expression-literals.html" rel="nofollow">babel-plugin-transform-member-expression-literals</a> doesn't seem to help.
</li> <li>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.
</li> <li>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.
</li> </ol><h2><strong>Config</strong></h2>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.
<strong>My babelrc:</strong>
{
plugins: ["transform-member-expression-literals"],
presets: [
[ "@babel/preset-env",
{
useBuiltIns: "entry",
modules: "false",
targets: {
ie: 11
}
}]
]
}
<strong>webpack.config</strong>
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.
Answer1:Take a look at the link below
<a href="http://github.com/facebook/create-react-app/issues/4255" rel="nofollow">github.com/facebook/create-react-app/issues/4255</a>