Angular-cli 8 - Is it possible to build only on es2015?

前端 未结 2 1562
野趣味
野趣味 2021-02-19 08:11

In version 8 of angular-cli, the build is done 2x. One in es5 and one in es2015.

Is it possible to build only on es2015?

Changing the target to es5, it is done o

2条回答
  •  不思量自难忘°
    2021-02-19 09:06

    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.

    For example, when using

    "browserslist": [
      "> 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%...)

    (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.)

提交回复
热议问题