首页 > 解决方案 > 将 Firefox 更新到版本 8 后,Angular 应用程序无法在 Firefox 上运行

问题描述

我们已将 Angular 应用程序从 7.2 版更新到 8 版。到目前为止,更新过程已经奏效,该应用程序可以像往常一样在 Chrome、Firefox 开发者版、Safari、Opera 上以本地和 prod 模式(在服务器上)使用。

但是在普通的火狐浏览器和Waterfox中,该应用程序不起作用:

我们创建了一个包含以下内容的浏览器列表文件:

# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
# npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

我们的 tsconfig 如下所示:

{
  "compileOnSave": false,
  "compilerOptions": {
    "downlevelIteration": true,
    "importHelpers": true,
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2015",
    "typeRoots": [
      "Node_modules / @ types"
    ]
    "lib": [
      "ES2016"
      "Dom"
    ]
    "module": "esnext"
  }
}

以及在 angular.json 中具有 ssl 配置的区域,因此:

  "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
      "browserTarget": "farm-management-ui:build",
      "port": 8080,
      "ssl": true,
      "proxyConfig": "src/proxy.conf.js"
    },

我们已经成功执行了以下命令:

ng update @ angular / cli --from 7 --to 8 --migrate - 仅

ng update @ angular / core - 从 7 到 8 --migrate-only

而且我有一种感觉,如果应用程序在 Firefox 中运行,则会创建一个无限循环,因为我也无法打开其他网页,如 Stackoverflow 等。

为什么 Firefox 突然出现这种行为,我们该如何解决?

标签: angulartypescriptbrowserpolyfillsangular8

解决方案


tsconfig.json中的属性targetes2015更改为旧值es5,应用程序可以工作。


推荐阅读