Clarification on Babel Polyfill Documentation #12833
Labels
stale?
Issue that may be closed soon due to the original author not responding any more.
type: documentation
An issue or pull request for improving or updating Gatsby's documentation
Summary
The language in the 1 -> 2 migration guide around the babel-polyfill is somewhat confusing, so I'd like to get some clarification if possible!
I originally asked this in another thread (#7064 (comment)), but I think it makes more sense as a standalone question.
Relevant information
I'm confused by this because my understanding is that
babel-polyfill
makes its changes globally (as opposed to injecting things into the scope of each module). That seems to match what its docs say:If that's the case, what does the migration guide mean when it says that this is "not yet implemented for code imported from node_modules"? I would think that the node_modules code would have access to the polyfills if they're in the global scope.
Is the issue that, because Gatsby uses
useBuiltIns: 'usage'
, and because out of the box Gatsby does not transpilenode_modules
, babel may not inject the polyfills required by thosenode_modules
because babel never sees their code? Meaning, if some of the transpiled code did require the same polyfills, they would be available to the code from node_modules, but if not, the polyfill would never get injected.Finally (and maybe most importantly), since React requires
Map
andSet
, does this caveat mean that Gatsby 2 may not work out of the box for older browsers, because there's no guarantee that they would get polyfilled?I'm happy to contribute back to the docs on this if applicable.
Environment (if relevant)
N/a
File contents (if changed)
N/a
The text was updated successfully, but these errors were encountered: