-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modularize polyfills #8854
Comments
This assumes everyone is using the Common JS module loader. What about those using an AMD loader, a SystemJS loader, etc? |
oh that was just an example, I guess we could actually use the existing TypeScript capability of turning any import code into the chosen module loader. E.g. a sort of intermediate compilation with:
The basic idea here is to put polyfills into modules to save space. But perhaps that work might be delegated to the bundlers (webpack/browserify/etc...) by the use of a specific plugin. |
thanks and sorry for the dupe--I always check but sometimes you don't know what terms to look for. |
Also, for completeness, #3364 is delivering the helpers as a module for TS2.0 as per the roadmap. |
As far as I know, polyfill functions are repeated in each file they are needed, resulting in lot of duplicate code.
I suggest to optionally emit them as a module, so that they appear once in a bundled project.
E.g. instead of:
emit this:
The text was updated successfully, but these errors were encountered: