首页 > 解决方案 > Angular 6 - 在 IE11 上使用 lite-server 运行 dist 文件夹不起作用

问题描述

我正在尝试在 IE 上运行我的 Angular 6 dist 文件夹。它在 Chrome 中完美运行。IE 在选项卡中正确显示标题,但页面上没有任何内容。我安装了 classlist.js 和 web-animations-js polyfills。该项目在开发中有效,但在生产中无效。我运行 ng build --prod --build-optimizer 来创建 dist 文件夹。

标签: angularinternet-explorerangular6production-environmentlite-server

解决方案


在 polyfills.ts 文件中的 polyfills 下面取消注释,然后重新构建它会起作用。

* 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/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';

推荐阅读