Skip to content
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

Polyfill imports can't be treeshaken #710

Closed
NickColley opened this issue May 22, 2018 · 3 comments
Closed

Polyfill imports can't be treeshaken #710

NickColley opened this issue May 22, 2018 · 3 comments

Comments

@NickColley
Copy link
Contributor

When we import polyfills they're global.

Since a build system can't know where they're used, it can't make a decision to include it or not.

You can see an example of this here:

import '../../vendor/polyfills/Function/prototype/bind'

A potential solution would be to have a function that polyfills return that can be called.

import polyfillBind from '../../vendor/polyfills/Function/prototype/bind'
polyfillBind()
@NickColley
Copy link
Contributor Author

Just realised this is only a problem if using the 'all' entry point. Which currently doesnt allow a destructured import.

So will close for now, may re-open if we decide to allow a destructured import.

@NickColley
Copy link
Contributor Author

NickColley commented Aug 17, 2018

We now encourage a destructured import so this is an issue

@NickColley NickColley reopened this Aug 17, 2018
@NickColley
Copy link
Contributor Author

Actually, let's focus on ES6 modules tree shaking before this... Will add a comment to that instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant