question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide a way of enabling differential loading only on certain builds

See original GitHub issue

πŸš€ 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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mattlewis92commented, May 28, 2020

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.

1reaction
marczellmcommented, Mar 24, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide to Angular 8's Differential Loading | by Auth0 | Medium
Differential loading lets you serve up different bundles to different browsers and make your application even faster! Angular 8 has only been out...
Read more >
A Guide to Angular 8's Differential Loading Feature - Auth0
Differential loading lets you serve up different bundles to different browsers and make your application even faster! Angular 8 has only ...
Read more >
Angular 8 CLI: Disable differential loading in development serve
In Angular CLI version 8 and higher, differential loading is enabled by default for the ng build command. The ng serve, ng test,...
Read more >
Deployment - Angular
Differential loading is a strategy that allows your web application to support multiple browsers, but only load the necessary code that the browser...
Read more >
What's new in Angular CLI 13.0? - Ninja Squad
As a result, ng build no longer does differential loading, and only outputs ES2015+ code. IE11 no longer being a concern, all the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found