Angular-cli: Provide a way of enabling differential loading only on certain builds

Created on 30 May 2019  路  4Comments  路  Source: angular/angular-cli

馃殌 Feature request

Command (mark with an x)


- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

Currently browserslist is used to determine whether to create an es5 build as well as es2015. However that is global for the whole project, what I'd like is a way to only build an es5 version on our production environment, our staging environment already takes ~20 minutes to build, building an es5 version is only going to make this build time longer and all of our staging users are on modern browsers

Describe the solution you'd like

To allow forcing differential loading for certain builds in angular.json via the es5BrowserSupport flag. Currently it only has an effect on the polyfills and not whether an es5 build is created.

Describe alternatives you've considered

There are no arounds AFAIK

devkibuild-angular browser triage #1 feature

Most helpful comment

For Angular v10 a new --legacy-browsers flag was added in a723af4, if you don't provide that flag, ES5 bundles won't be present in your builds.

I think that's a schematics option only, if I understood the commit correctly it just controls what gets put into the browserslist file when creating an application. i.e. you can't do ng build --legacy-browsers to selectively enable or disable differential loading when building different environments.

All 4 comments

Browserslist already has a feature called "environments", see here:
https://github.com/browserslist/browserslist#configuring-for-different-environments

I tried to use it to create a "development" environment where no ES5 version is built, only to realize that neither BROWSERSLIST_ENV nor NODE_ENV influences the way the angular build system loads the browserslist file. Please help!

Experiencing same problem, spending additional 30 seconds and 15 mb on building es5 bundles that would never be used on dev envs, waiting for this feature to be added very much

For Angular v10 a new --legacy-browsers flag was added in https://github.com/angular/angular-cli/commit/a723af4271a3e9cf35d5c386b050999ad87ed3b9, if you don't provide that flag, ES5 bundles won't be present in your builds.

For Angular v10 a new --legacy-browsers flag was added in a723af4, if you don't provide that flag, ES5 bundles won't be present in your builds.

I think that's a schematics option only, if I understood the commit correctly it just controls what gets put into the browserslist file when creating an application. i.e. you can't do ng build --legacy-browsers to selectively enable or disable differential loading when building different environments.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JanStureNielsen picture JanStureNielsen  路  3Comments

5amfung picture 5amfung  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

sysmat picture sysmat  路  3Comments

donaldallen picture donaldallen  路  3Comments