【问题标题】:Angular IE11 Syntax error vendor.js (124116) class Dom7Angular IE11 语法错误 vendor.js (124116) 类 Dom7
【发布时间】:2019-07-14 03:05:48
【问题描述】:

当我在 IE11 中打开我的项目时,我得到了

SCRIPT1002:语法错误

vendor.js (124116,1)

当我导航到指定行上的 vendor.js 时,我发现

class Dom7 {
constructor(arr) {
    const self = this;
    // Create array-like object
    for (let i = 0; i < arr.length; i += 1) {
      self[i] = arr[i];
    }
    self.length = arr.length;
    // Return collection with methods
    return this;
  }
}

我尝试了所有解决方案的组合,例如取消注释所有 pollyfils.ts

import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

同样针对 es5/es6,在 tsconfig.json 中更改 lib(添加 es2016)等

"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
  "node_modules/@types"
],
"lib": [
  "es2017",
  "dom"
]}

谁能帮忙,我没办法了

【问题讨论】:

    标签: angular syntax vendor


    【解决方案1】:

    这是依赖关系的问题,我对 ngx-useful-swiper 库也有同样的问题,你不需要 polyfills,只需将你的代码转换为 es5 语法

    【讨论】:

      猜你喜欢
      • 2020-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-26
      • 1970-01-01
      • 1970-01-01
      • 2019-10-10
      相关资源
      最近更新 更多