简体   繁体   English

由Babel Polyfill引起的IE11错误-委托.iterator.return

[英]Error in IE11 caused by babel polyfill - delegate.iterator.return

Hope to get some help with following: 希望在以下方面获得帮助:

The problem 问题

@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. 它包含相同的代码,但不会破坏任何内容。

What I've already tried: 我已经尝试过的:

  1. babel-plugin-transform-member-expression-literals doesn't seem to help. babel-plugin-transform-member-expression-literals似乎没有帮助。

  2. 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. 大量错误导致应用程序难以捕获/调试/理解。

  3. 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. 我将再尝试一次。

  4. 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的所有相同问题,但没有找到有效的解决方案。

Config 设定档

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. 感谢任何帮助或想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Gulp & Babel polyfill Promises for IE11 issue - Gulp & Babel polyfill Promises for IE11 issue IE11的URL Polyfill - URL Polyfill for IE11 未处理的承诺拒绝 InvalidCharacterError 在 IE11 中使用 VEE 验证 Vue.js 和 babel-polyfill - Unhandled promise rejection InvalidCharacterError in IE11 with VEE Validate Vue.js and babel-polyfill 我如何使用babel polyfill支持gulp的所有IE11问题 - how can I use babel polyfill to support all IE11 issues with gulp Babel 7 不会在 IE11 中填充 Promise、Fetch 和一些 JavaScript 文件(如在供应商文件中) - Babel 7 does not polyfill Promise, Fetch and some JavaScript files (like in a vendor file) in IE11 VueJs / @Babel Polyfill在IE11 v 11.371上不起作用/ prod build - VueJs / @Babel polyfill not working on IE11 v. 11.371 / prod build 使用 babel-polyfill 后,classList.replace() 不是 IE11 中的方法或属性 - classList.replace() is not a method or property in IE11 after using babel-polyfill 包含babel polyfill,但forEach仍然无法在NodeLists上的IE11中工作 - babel polyfill being included, but forEach still doesn't work in IE11 on NodeLists 用于 IE11 的带有 Babel 的 Svelte - Svelte with Babel for IE11 ie11尝试使用flat()polyfill方法会在polyfill中导致错误 - ie11 Attempt to use the method flat() polyfill causes error within the polyfill
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM