Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 560
dota2pro Avatar asked Jun 05 '19 16:06

dota2pro


People also ask

What does ng build actually do?

The ng build command is intentionally for building the apps and deploying the build artifacts. The command does not generate an output folder. The output folder is – dist/. The ng serve builds artifacts from memory instead for a faster development experience.

Does angular support mobile browsers?

Recent versions of Angular supports all latest versions of all major browsers like Firefox, Chrome, Safari, iOS and Android.

Does ng build default to production?

ng build now uses the production configuration by default. You no longer need to pass the --prod option to the command.


1 Answers

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

like image 87
dota2pro Avatar answered Nov 15 '22 03:11

dota2pro