问题描述
在angular-cli的版本8中,构建完成了2倍. es5中的一项,es2015中的一项.
In version 8 of angular-cli, the build is done 2x. One in es5 and one in es2015.
是否可以仅在es2015上构建?
Is it possible to build only on es2015?
将目标更改为es5,只能在es5中完成..但是我还没有找到仅在es2015中实现此目标的方法.
Changing the target to es5, it is done only in es5 .. But I have not found a way to do it only in es2015.
推荐答案
如果您相应地更新浏览器列表 (package.json
中的.browserlistrc
-file或browserlist
-Array),并且仅添加具有ES2015功能的浏览器,应仅创建一个内部版本.
If you update your browserslist accordingly (.browserlistrc
-file or browserlist
-Array in package.json
) and only add browsers which are capable of ES2015, only one build should be created.
例如,使用时
"browserslist": [
"> 5%"
]
我只得到一个版本,而不是es5
和es2015
的两个版本. (好吧,公平地说,只有chrome使用> 5%
...进入列表了)
I only get one build instead of two builds for es5
and es2015
. (Okay, to be fair, only chrome makes it into the list with > 5%
...)
(您还可以使用npx browserslist
来检查项目设置当前支持的浏览器列表.另请参阅差异加载"部分在此处进行详细说明.)
(You can also check with npx browserslist
for a list of browsers that would currently be supported with your project setup. Also, see the "Differential Loading"-part here for a detailed explanation.)
这篇关于Angular-CLI 8-是否可以仅在es2015上构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!