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.

Intelligently load polyfills

See original GitHub issue

Feature 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

  1. a script could be inlined (maybe) to load the polyfills that we know for sure angular requires
  2. the initial bootstrapping would need to wait until the polyfills were loaded or even better, not loaded. (reference bottom of the referenced article)
  3. 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:closed
  • Created 6 years ago
  • Reactions:37
  • Comments:25 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
clydincommented, Jan 25, 2019

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

5reactions
dharapvjcommented, Dec 28, 2017

See how angular.io website splits IE polyfills out… Issue Fix

Can something like this be implemented? It does not seem very difficult.

Read more comments on GitHub >

github_iconTop 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 >

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