dota2pro
dota2pro

Reputation: 7874

Angular ng build with minimum number of files ? (supporting only Chrome is also fine)

When I build my angular project i see

main-es5.js and main-es2015.js both files. I just want to support only Chrome browser how can I turn off building the old js files I want minimum number of files on Build.

My Build also runs twice since I upgraded to 8

Note

Build time has significantly increased and i get the warning WARNING in budgets, maximum exceeded for initial.

This is my Angular.json File

      "optimization": true,
      "outputHashing": "none",
      "sourceMap": true,
      "extractCss": false,
      "namedChunks": false,
      "showCircularDependencies": false,
      "aot": true,
      "extractLicenses": false,
      "statsJson": false,
      "progress": true,
      "vendorChunk": false,
      "buildOptimizer": true,

browserlist file

# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
#   npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

Edit: Raised feature request on Github

Upvotes: 6

Views: 2441

Answers (2)

dota2pro
dota2pro

Reputation: 7874

As per @clydin 's comment on GitHub

**browserlist** 
last 2 Chrome versions

https://browserl.ist/?q=last+2+Chrome+versions

Creates a minimal chrome only ES2015+ build

Upvotes: 6

Ankush Jane
Ankush Jane

Reputation: 176

Inside tsconfig.json there is target : "es2015" change target to "es5" you will get build like angular 7 application.

Upvotes: 3

Related Questions