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

[Question] How to remove unused javascript in GatsbyJS? #24586

Closed
daydream05 opened this issue May 28, 2020 · 2 comments
Closed

[Question] How to remove unused javascript in GatsbyJS? #24586

daydream05 opened this issue May 28, 2020 · 2 comments
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@daydream05
Copy link
Contributor

daydream05 commented May 28, 2020

Summary

The new Lighthouse added additional reccomendations such as
Remove unused javascript

How would I go about figuring out how to remove the unused javascript?

The report shows the path but they're all minified but I'm not sure how to get rid of them. (It looks a couple is Firebase)

I've deleted all unused imports but I still have a large chunk of unused js.

Relevant information

Here's the lighthouse report for the page in question:

Screen Shot 2020-05-28 at 5 14 29 PM

Gatsby site has also some unused js
Screen Shot 2020-05-28 at 5 18 08 PM

@daydream05 daydream05 added the type: question or discussion Issue discussing or asking a question about Gatsby label May 28, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 28, 2020
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 29, 2020
@LekoArts
Copy link
Contributor

LekoArts commented May 29, 2020

Thank you for opening this!

You'll want to use something like https://www.gatsbyjs.org/packages/gatsby-plugin-webpack-bundle-analyser-v2/ to see which packages are included in the individual pages so that you can either remove them (if not necessary) or lazy-load them.

Furthermore, it seems like Google changed their metrics. It makes sense to group this under this issue #24332 - feel free to comment there once you figured out what your individual issue was.

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

@IwateKyle
Copy link

IwateKyle commented Jul 6, 2020

Yes, I'm new to Gatsby and was wondering the same thing. I just built a tutorial and ran it thru Lighthouse and get pretty low scores. The first observation was too much unused javascript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants