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

Avoid loading polyfill (gatsby-legacy-polyfills) #28736

Closed
ghost opened this issue Dec 22, 2020 · 1 comment
Closed

Avoid loading polyfill (gatsby-legacy-polyfills) #28736

ghost opened this issue Dec 22, 2020 · 1 comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@ghost
Copy link

ghost commented Dec 22, 2020

Description

I used this tool to see the js loaded in the project and I see polyfills - I am trying to not load node_modules/gatsby-legacy-polyfills/dist at all - I tried to set browserlists to just latest chrome but still polyfills loads. How can I make sure polyfills is not loaded at all?

Steps to reproduce

Set browserlist to

"browserslist": [
    "last 2 Chrome versions"
  ],
  • run gatsby clean
  • run gatsby build
  • polyfill is still loaded

Expected result

polyfill should not be loaded

Actual result

using this tool I can see that polyfill.js is loaded

Environment

  Binaries:
    Node: 12.19.0
    Yarn: 1.21.1 
    npm: 6.14.8
  Languages:
    Python: 2.7.16
  npmPackages:
    gatsby: ^2.27.0 => 2.27.0 
    gatsby-cli: 2.13.1
@ghost ghost added the type: bug An issue or pull request relating to a bug in Gatsby label Dec 22, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 22, 2020
@ghost ghost changed the title Avoid loading polyfill Avoid loading polyfill (gatsby-legacy-polyfills) Dec 22, 2020
@KyleAMathews
Copy link
Contributor

Hi that bundle is generated on every build but only loads on older browsers. Try it yourself and load a site in chrome. The polyfill is in the html but won't load (as seen in the network tab). This way Gatsby can support older browsers but not load polyfills when they're not needed.

The bundle analyzer just shows all created bundles and isn't going to be an accurate representation in this case of what the browser loads.

@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants