how to turn off differential loading in Angular v8?

后端 未结 10 1909
暖寄归人
暖寄归人 2020-12-05 02:47

Angular-CLI v8 implemented differential loading. But I don\'t need files built by es5. I want to decrease deploy quantity.

I tried below. But CLI has generated es5 f

相关标签:
10条回答
  • 2020-12-05 03:14

    Simply

    > 5.0%
    last 1 edge versions
    

    will do the job

    0 讨论(0)
  • 2020-12-05 03:16

    Fastest solution: Switch back to es5 as compilation target in your tsconfig.json.

    "compilerOptions": {
            ...
            "target": "es5"
            ...
    }
    

    As mentioned on Angular official documentation (https://angular.io/guide/deployment#differential-loading):

    To explicitly disable differential loading:

    • Enable the dead or IE browsers in the browserslist config file by removing the not keyword in front of them.
    • Set the target in the compilerOptions to es5.
    0 讨论(0)
  • 2020-12-05 03:16

    I succeeded to build without es5 files in Angular v8-rc4.

    set like below in browserList to make isEs5SupportNeeded false in build-angular.

    > 0.5%
    last 2 versions
    Firefox ESR
    not dead
    not samsung 4
    not android 4.4.3-4.4.4
    not last 2 IE versions
    not last 2 ie_mob versions
    not last 2 op_mini versions
    not last 2 op_mob versions
    not last 2 baidu versions
    not last 2 kaios versions
    not last 2 and_uc versions
    not last 2 and_qq versions
    not last 2 edge versions
    

    refer to this list. https://caniuse.com/#feat=es6-module

    0 讨论(0)
  • 2020-12-05 03:21

    At the moment many people have es5 bundle generated because @angular/cli does not consider latest Edge (i.e., Edge 18) to be es2015-modules compliant: https://github.com/angular/angular-cli/issues/14580.

    A dirty fix is to exclude Edge from the list of browsers you support (in the browserslist file). This problem should be fixed if you upgrade to @angular/cli 8.1.0.

    0 讨论(0)
提交回复
热议问题