Angular-cli: [Bug] Angular-cli 8.1 insists on building for es5 while I want only es2015

Created on 4 Jul 2019  路  5Comments  路  Source: angular/angular-cli

馃悶 Bug report

Command (mark with an x)


- [ x] build

Description

I want es2015 codes only for my LOB app running on Chrome primarily though Firefox and Edge may be supported. I had done respective config in tsconfig.json and package.json.

馃敩 Minimal Reproduction

Prerequisites:
Angular 8.1
Angular CLI 8.1

In package.json, I have:

    "browserslist": [
        "last 2 versions",
        "Firefox ESR",
        "not dead",
        "not IE 9-11"
    ],

as suggested in https://github.com/browserslist/browserslist

In tsconfig.json,

{
    "compileOnSave": false,
    "compilerOptions": {
        "baseUrl": "./",
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es2015",
        "typeRoots": [
            "node_modules/@types"
        ],
        "lib": [
            "es2018",
            "dom"
        ],
        "skipLibCheck": true
    }
}

馃敟 Exception or Error

Both es5 and es2015 codes are produced, while https://angular.io/guide/deployment#differential-loading suggested a single build.

Most helpful comment

Hi @zijianhuang, indeed that a single build when ES5 support is not needed but with your browserslist query you are stating that you want ES5 support.

You should be more specific in your query and specify the browsers that you want to support example;

last 2 Chrome versions
last 2 Safari versions
last 2 Firefox versions

Thanks.

All 5 comments

last 2 versions triggers the ES5 build. Which part of the documentation suggests a single build?

@mgechev ,
"Configuring differential loading" in https://angular.io/guide/deployment#differential-loading
and there's a table:
ES5 BROWSERSLIST RESULT | ES TARGET | BUILD RESULT
indicating "Single Build". -- "If you ignore browsers without ES2015 support, a single build is produced."

Hi @zijianhuang, indeed that a single build when ES5 support is not needed but with your browserslist query you are stating that you want ES5 support.

You should be more specific in your query and specify the browsers that you want to support example;

last 2 Chrome versions
last 2 Safari versions
last 2 Firefox versions

Thanks.

@zijianhuang , The proper answer is that you have to exclude Edge from browserslist, even though you support it. See https://github.com/angular/angular-cli/issues/14580

_Update_: An even better option is to upgrade to @angular/cli 8.1.0 where the problem with Edge is fixed, thanks to @alan-agius4 .

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings