angular - 将 Firefox 更新到版本 8 后,Angular 应用程序无法在 Firefox 上运行
问题描述
我们已将 Angular 应用程序从 7.2 版更新到 8 版。到目前为止,更新过程已经奏效,该应用程序可以像往常一样在 Chrome、Firefox 开发者版、Safari、Opera 上以本地和 prod 模式(在服务器上)使用。
但是在普通的火狐浏览器和Waterfox中,该应用程序不起作用:
- 该应用程序尝试在浏览器显示状态“Performing a tls handshake to localhost”时进行渲染,直到某个时候出现“连接已超时”。
- 在 prod 模式下,在我部署应用程序后,至少会显示登录掩码,但应用程序的性能非常糟糕,几乎没有任何效果。
我们创建了一个包含以下内容的浏览器列表文件:
# 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 突然出现这种行为,我们该如何解决?
解决方案
将tsconfig.json中的属性target
从es2015更改为旧值es5,应用程序可以工作。
推荐阅读
- css - 第二页的 CSS @page 设置
- postgresql - PostgreSQL | 设备上没有剩余空间
- php - Laravel Eloquent 的 Mysql 索引
- java - 持久列表
处于休眠状态 - xamarin.forms - 错误 XF003:Xamarin.Forms 需要 msbuild。不再支持 xbuild
- c# - 缓存 wcf 服务的问题 - “AspNetCacheProfileAttribute 只能用于 GET 操作”
- javascript - 在 php 中使用 javascript var 获取 wordpress 附件
- proxy - 具有公司代理身份验证的 Chrome 无头浏览器无法正常工作
- android - 片段中的轮播错误
- vidyo - Vidyo - 如何设置 logFileName 写入本地文件