Intelligently load polyfills
See original GitHub issueFeature Request
- [ ] bug report -> please search issues before submitting
- [x] feature request
Versions.
future
Desired functionality.
Apologies if this already tracked somewhere I couldn’t find it/ At the moment all polyfills are loaded into all browsers, it would be awesome if we could only load the polyfills that are needed by the browser the app is running in. This would help will smaller overall payload size for more modern browsers and keep legacy browsers working without having to manually manage the polyfills.ts file.
Additional information
Article for reference: https://philipwalton.com/articles/loading-polyfills-only-when-needed/
Initial thoughts
- a script could be inlined (maybe) to load the polyfills that we know for sure angular requires
- the initial bootstrapping would need to wait until the polyfills were loaded or even better, not loaded. (reference bottom of the referenced article)
- polyfills.ts would still exist but would only be used to load zone.js and additional polyfills that the user wants to add.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:37
- Comments:25 (8 by maintainers)
Top Results From Across the Web
Polyfill, Vendors and App Bundle using Webpack 4
Load polyfill : * This file and its dependencies get bundled into the "polyfills" chunk by WebPack and loaded as first scripts.
Read more >How to load polyfills only when needed
I know three ready-to-use approaches for that: polyfill.io; the module / nomodule pattern; the useBuiltIns option in @babel/preset-env ...
Read more >smoothscroll-anchor-polyfill
The polyfill uses Event Delegation to detect clicks, so even if an anchor is added to the page after the polyfill was loaded,...
Read more >Angular11 + webcomponents/polyfills + IE11 == nojoy
I have run into this issue with IE11, to fix it I removed 'document-register-element' from the polyfills.ts and loaded it on page before...
Read more >How babel preset-env, core-js, and browserslistrc work together
What core-js can do with babel is intelligent loading of polyfills depending on the target. To install core-js run: npm i core-js.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Support for this will be available in CLI version 7.3 currently in release candidate stage. An overview of the functionality can be found in the PR description found here: https://github.com/angular/angular-cli/pull/13403
See how angular.io website splits IE polyfills out… Issue Fix
Can something like this be implemented? It does not seem very difficult.