我正在IE11上运行angular 9。在tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
},
"angularCompilerOptions": {
"strictInjectionParameters": true
}
}
是的,如果我使用"target": "es5"
而不是"target": "es2015"
,它将起作用。
所以我的问题是我可以使用"target": "es2015"
在IE11上运行角度9吗?我虽然出错了。
错误:err
我已评论了core-js/..
的所有polyfills.ts
导入。
因为:https://stackoverflow.com/a/56893234/14208324
polyfills.ts:
/** 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';
import 'classlist.js';
/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
// import 'core-js/es7/reflect';
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
**/
import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
Angular和Anglura-cli版本:
Angular CLI: 9.1.12
Node: 10.15.3
OS: win32 x64
Angular: 9.1.12
注意:如果我使用"target": "es5"
作为目标,则不会显示任何错误,但是页面仍为空白。应用程序正在chrome和firefox上运行。
我想念什么吗?
答案 0 :(得分:0)
如果目标设置为 es2015 ,则Angular应用将无法与IE浏览器一起使用。
在将 target 设置为 es2015 的IE浏览器中,我没有任何办法使Angle App正常工作。
因此,无法通过将 target 用作 es2015 来支持angular应用。
用户需要将 target 设置为 es5 以支持IE浏览器。