【发布时间】:2018-09-20 23:05:52
【问题描述】:
我有一个可以在 chrome 上完美运行的 angular2 应用程序。
但是当我用 IE11 打开这个应用程序时,我什么也看不到。
控制台报错:
vendor.bundle.js 中似乎有错误。
在这个文件的尖线中,调用了“eval”函数,代码很长。
我猜IE11不支持某些命令。
我想要做的:复制 eval 函数中的代码,用这段代码替换调用 eval,然后我会得到错误所在的确切行。
但是 vendor.bundle.js 甚至没有出现在我的应用程序中...
那个文件是什么?
我怎样才能改变它?
或者也许这个问题有其他解决方案?
角度信息:
Angular CLI:1.6.4
节点:8.9.4
操作系统:win32 x64
角度:5.2.0
-----添加-----
我的 polyfills.ts 文件:
// This file includes polyfills needed by Angular and is loaded before the app.
// You can add your own extra polyfills to this file.
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/set';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
// If you need to support the browsers/features below, uncomment the import
// and run `npm install import-name-here';
// Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
// Needed for: IE9
// import 'classlist.js';
// Animations
// Needed for: All but Chrome and Firefox, Not supported in IE9
import 'web-animations-js';
// Date, currency, decimal and percent pipes
// Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
import 'intl';
// NgClass on SVG elements
// Needed for: IE10, IE11
import 'classlist.js';
【问题讨论】:
-
该文件是您正在部署的已编译代码的一部分。很难用这么少的信息说出问题所在 - 请提供您的应用配置minimal reproducible example。
-
@jonrsharpe 添加了角度版本信息。是你的意思吗?
-
您的应用程序是否基于 CLI?你激活了 polyfills 了吗?
-
@Osman Cea 你是什么意思?
-
如果您使用 Angular CLI 构建应用程序,则有一个名为
polyfills.ts的文件,其中包含一些 pollyfills 您必须取消注释并安装才能使您的应用程序在 IE 上运行,尽管我不确定如果 IE 11 需要的话。
标签: angular internet-explorer vendor