【问题标题】:Angular 6 - Running dist folder with lite-server on IE11 doesn't workAngular 6 - 在 IE11 上使用 lite-server 运行 dist 文件夹不起作用
【发布时间】:2019-02-13 07:13:28
【问题描述】:

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

【问题讨论】:

  • 如果打开浏览器开发者工具,会显示什么错误?您可能需要刷新页面才能看到错误。
  • IE11 中的开发工具为以下每个文件显示“SCRIPT1010:预期标识符”:browser-sync-client.js、runtime.js、polyfills.js 和 main.js
  • 问题在于 IE 的兼容模式。这是修复:stackoverflow.com/questions/3449286/…

标签: angular internet-explorer angular6 production-environment lite-server


【解决方案1】:

在 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';

【讨论】:

  • 感谢您的回复!所有这些都没有注释,它仍然不起作用。这是一个奇怪的问题。它在开发和本地主机上运行良好,但是当我尝试使用外部服务器时,它的行为就像我安装和取消注释 polyfill 之前一样。
猜你喜欢
  • 2018-12-10
  • 2019-04-06
  • 2019-10-03
  • 2022-06-22
  • 2016-05-05
  • 1970-01-01
  • 2017-06-10
  • 2018-10-19
  • 1970-01-01
相关资源
最近更新 更多