Closed NickColley closed 6 years ago
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.
We now encourage a destructured import so this is an issue
Actually, let's focus on ES6 modules tree shaking before this... Will add a comment to that instead.
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:
https://github.com/alphagov/govuk-frontend/blob/de2b8db0dcc71da3d8be2d0ad2a4f0b5b728dbb6/src/components/checkboxes/checkboxes.js#L1
A potential solution would be to have a function that polyfills return that can be called.