Angular-CLI 8-是否可以仅在es2015上构建? [英] Angular-cli 8 - Is it possible to build only on es2015?

查看:289
本文介绍了Angular-CLI 8-是否可以仅在es2015上构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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%"
]

我只得到一个版本,而不是es5es2015的两个版本. (好吧,公平地说,只有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上构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆