How to decrease prod bundle size?

后端 未结 14 1346
Happy的楠姐
Happy的楠姐 2020-11-28 01:31

I have a simple app, initialized by angular-cli.

It display some pages relative to 3 routes. I have 3 components. On one of this page I use lodash

14条回答
  •  遥遥无期
    2020-11-28 01:40

    If you are using Angular 8+ and you want to reduce the size of the bundle you can use Ivy. Ivy comes as the default view engine in Angular 9 Just go to src/tsconfig.app.json and add the angularCompilerOptions parameter, for example:

    {
      "extends": ...,
      "compilerOptions":...,
      "exclude": ...,
    
    /* add this one */ 
      "angularCompilerOptions": {
        "enableIvy": true
      }
    }
    

提交回复
热议问题