gatsby: gatsby build very slow
Description
Trying out gatsby for the first time. Not sure if “blazing fast” applies to the production builds, or just while developing, or maybe I’m using the wrong command. Any help is appreciated.
Running gatsby build. Site created from gatsby-starter-docs which is based on gatsby-advanced-starter. If this is unusual performance, a pointer to a known fast base would be appreciated.
Gatsby version: 1.8.11
info bootstrap finished - 2.292 s
success Generating CSS — 53.505 s
success Compiling production bundle.js — 96.203 s
success Generating static HTML for pages — 44.830 s
Total precache size is about 405 kB for 5 resources.
success Done building in 197.28 seconds
Gatsby version 1.9.149 (upgraded all deps in the project to the ‘latest’ npm tag).
info bootstrap finished - 2.656 s
success Building CSS — 37.436 s
success Building production JavaScript bundles — 79.457 s
success Building static HTML for pages — 39.995 s
Total precache size is about 737 kB for 8 resources.
info Done building in 159.631 sec
It’s fast in development mode, but the development startup time is also quite slow. The server doesn’t even listen on the port for around 8 seconds.
Development mode output:
info bootstrap finished - 2.827 s
DONE Compiled successfully in 36494ms 21:11:13
You can now view high-redux-docs in the browser.
http://localhost:9911/
View GraphiQL, an in-browser IDE, to explore your site's data and schema
http://localhost:9911/___graphql
Note that the development build is not optimized.
To create a production build, use gatsby build
WAIT Compiling... 21:11:13
DONE Compiled successfully in 1615ms
Environment
Gatsby version: 1.8.11, also tried upgrading to ^1.9.149 Node.js version: 8.9.0 Operating System: OSX, Darwin {my host} 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
File contents (if changed):
Repo here: https://github.com/brigand/high-redux-docs
Running yarn build:pp.
Actual result
It takes a very long time, even if I don’t modify any files between runs.
Thanks for the otherwise amazing tool!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 20 (11 by maintainers)
It is actually quite a pain when you are debugging SSR issues.
😕
If you want fast builds, turns out you need the newly announced Gatsby builds, part of the commercial Gatsby Cloud offering.
I’m on Gatsby 2.18.8, and building a very simple site takes 3 minutes on a VPS with 2GB RAM.
The build process stays stuck at this step for 2 minutes:
The last lines of the output are:
I’m using https://github.com/AustinGreen/gatsby-starter-netlify-cms, all content local, 3 pages, and build time is 60 seconds. Updated all packages to the latest.
Definitely very slow.
Mostly the JS bundle build.
I have been doubly spoiled by the speed of Parcel Bundler.
@brigand do you have instructions on how to implement both of those tips? Sounds like very useful hacks I could use.
By my current setup, I mean my gatsby site with the slow build. It’s not an issue, I just wasn’t sure if I was doing things correctly. I’m sorry I didn’t express that clearly. Thanks for the great project!
I created the project with the gatsby cli, wrote three markdown pages with no images, and then tried a build. So my best guess is that
gatsby-advanced-starteris pulling in a lot of stuff. It seems to have many features.Thanks for the clarification and your build times. Quite a difference objectively, but 80 seconds vs 159 seconds both fall in the “slow-ish” category, so optimizing down to that point isn’t super valuable.
I’ll stick with my current setup for this project, and try out 2.0 when it’s released.