6

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

dota2pro
  • 7,220
  • 7
  • 44
  • 79
  • 4
    This depends on browserslist. It's all explained in the documentation: https://angular.io/guide/deployment#differential-loading – JB Nizet Jun 05 '19 at 16:24
  • Define "Modern Browsers"? Do you want it to compile to ES6 instead of ES5? – Narm Jun 05 '19 at 16:25
  • edited my question, how can I get a minimum build for only Chrome latest versions, basically i want least amount of files on build. – dota2pro Jun 05 '19 at 16:29

2 Answers2

6

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

dota2pro
  • 7,220
  • 7
  • 44
  • 79
3

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

Ankush Jane
  • 146
  • 1
  • 1
  • 7