更新到Angular 16后的目标问题

huangapple go评论66阅读模式
英文:

Target problem after updating to Angular 16

问题

根据我的理解,Angular 16 devkit 从 Webpack 切换到了 Vite。我们并没有在 tsconfig 文件或任何其他构建配置文件中做任何更改。

然而,每次尝试构建时都会出现以下错误:

错误: 优化错误 [main.c3f825f1c692aa5f.js]: X [错误] 尚不支持将解构转换为配置的目标环境("chrome86.0","edge16.0","firefox83.0","ios11.0","safari11.0")

似乎它没有按照我正确理解的方式转换为较旧的JS版本。有人知道我应该怎么做吗,或者我是否漏掉了某种类型的文档?

英文:

So I recently upgraded my Angular packages to 16, as my understanding the Angular 16 devkit switched from Webpack to Vite. We have not changed anything in the tsconfig file or any other build configuration file.

However every time we try to build we get this error:

Error: Optimization error [main.c3f825f1c692aa5f.js]: X [ERROR] Transforming destructuring to the configured target environment ("chrome86.0", "edge16.0", "firefox83.0", "ios11.0", "safari11.0") is not supported yet

main.c3f825f1c692aa5f.js:89728:12:
  89728 │       const {

For some reason it does not transform to older JS versions if I understood the error correctly. Does anyone know what I should do, or have I missed some type of documentation?

答案1

得分: 0

以下是已翻译的内容:

"Okay for anyone facing the same issue.
这个问题适用于任何人。

The issue was a old .browserslistrc
问题出在一个旧的 .browserslistrc 文件上

You can read more about it here:
你可以在这里阅读更多相关信息:
https://stackoverflow.com/questions/70910612/my-project-doesnt-compile-with-optimization-parameters-after-upgrading-from-ang

Kind of the similar issue.
类似的问题。

I just updated it to
我刚刚更新了它为:

This file is currently used by autoprefixer to adjust CSS to support the below specified browsers

For additional information regarding the format and rule options, please see:

https://github.com/browserslist/browserslist#queries

For IE 9-11 support, please uncomment the last line of the file and adjust as needed

这个文件目前被 autoprefixer 使用,以调整 CSS 以支持下面指定的浏览器

关于格式和规则选项的额外信息,请参见:

https://github.com/browserslist/browserslist#queries

要支持 IE 9-11,请取消注释文件的最后一行并根据需要进行调整

0.5%
last 2 versions
Firefox ESR
not dead

IE 9-11

英文:

Okay for anyone facing the same issue.

The issue was a old .browserslistrc

You can read more about it here:
https://stackoverflow.com/questions/70910612/my-project-doesnt-compile-with-optimization-parameters-after-upgrading-from-ang

Kind of the similiar issue.

I just updated it to

# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For IE 9-11 support, please uncomment the last line of the file and adjust as needed
> 0.5%
last 2 versions
Firefox ESR
not dead
# IE 9-11

huangapple
  • 本文由 发表于 2023年7月3日 19:00:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76604116.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定