[英]Error in IE11 caused by babel polyfill - delegate.iterator.return
Hope to get some help with following: 希望在以下方面获得帮助:
@babel/polyfill causes error in IE11: @ babel / polyfill导致IE11中的错误:
SCRIPT1010: Expected identifier
Debugger point on the line: 调试器点就行了:
if (delegate.iterator.return) {
in the function maybeInvokeDelegate()
in regenerator-runtime
plugin. 在
regenerator-runtime
插件中的maybeInvokeDelegate()
函数中。
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.
它包含相同的代码,但不会破坏任何内容。
babel-plugin-transform-member-expression-literals doesn't seem to help. babel-plugin-transform-member-expression-literals似乎没有帮助。
I tried to replace @babel/polyfill with only necessary polyfills but I failed. 我尝试仅用必要的polyfill替换@ babel / polyfill,但失败了。 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. 设置
useBuiltIns: "usage"
中.babelrc
但面对方式,进口必要的模块有问题。 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. 我在github上浏览了regeerator-runtime和babel-polyfill的所有相同问题,但没有找到有效的解决方案。
At the moment I'm requiring @babel/polyfill in webpack config and use it as an entry point. 目前,我需要在webpack配置中使用@ babel / polyfill并将其用作入口点。 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. 我没有为webpack使用babel loader,而是在webpack之后为
/dist
目录运行babel。
My babelrc: 我的babelrc:
{
plugins: ["transform-member-expression-literals"],
presets: [
[ "@babel/preset-env",
{
useBuiltIns: "entry",
modules: "false",
targets: {
ie: 11
}
}]
]
}
webpack.config 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. 我已经将所有babel软件包更新为最新版本。
Appreciate any help or ideas. 感谢任何帮助或想法。
Take a look at the link below 看看下面的链接
github.com/facebook/create-react-app/issues/4255 github.com/facebook/create-react-app/issues/4255
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.