[英]Angular polyfills core-js not working as expected on IE11
[英]Angular 8 not working in IE11 even with polyfills
我有一個 angular 8 項目,並且在我的 polyfills.ts 文件中包含了 core-js 多邊形填充。
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** 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';
當我在 IE11 中加載應用程序時,我收到一條錯誤消息,提示 Object 預計在第 130k 行的 vendor-es5.js 中出現
我開始注釋掉我的代碼,並注意到當我使用for...of
循環時它被破壞了。 如果我將循環更改為.forEach
之類的東西,問題就會消失。 問題是我的代碼中有大量for...of
循環,我喜歡我可以使用return
跳出循環的事實
有任何想法嗎? 自周五以來一直試圖解決這個問題。 我確信我可以將所有代碼更改為使用 forEach,但我覺得我缺少一些簡單的東西。
編輯:添加了我如何初始化 object。
mcgs = {};
constructor(private configService: ConfigService, private router: Router, private sanitizer: DomSanitizer) {}
ngOnInit() {
this.configService.getMcgData().subscribe((response) => {
this.mcgs = response; <-- might be an issue.
......
IE11 不支持 ES2015+ 中for-of
或其他任何內容(除了對let
和const
的一些稍微不正確的支持)。
如果您希望您的項目在 IE11 中運行,則無需使用for-of
或使用Babel之類的工具將代碼轉換為 ES5。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.