首页 > 解决方案 > Angular 7 项目在 Internet Explorer 11 中不起作用

问题描述

我已经完成了互联网上不同帖子中提到的所有事情,但我的问题仍然存在。

我取消注释 IE 9、10、11 所需的 polyfill

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
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';

我在 index.html 中应用了元标记

<meta http-equiv="X-UA-Compatible" content="IE=edge" >

但是在 IE 11 中工作时我仍然遇到错误:

编辑 1 这是我的 tsconfig.json:

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

我应该怎么办?

任何帮助将不胜感激。

标签: angularinternet-explorer

解决方案


我用以下4个步骤解决了这个问题!对你来说,从第 3 步开始。

  1. 在你的项目中找到 polyfill.ts

  2. 取消注释所有已注释的导入 - 保存

  3. 在 npm 下面安装

    • npm install --save classlist.js
    • npm install --save web-animations-js
  4. 服务

信用:https ://blog.angularindepth.com/angular-and-internet-explorer-5e59bb6fb4e9

++如果您使用的是 angular8,请参考: https ://stackoverflow.com/a/59317315/10109195


推荐阅读