I’m trying to take advantage of the new Gatsby incremental builds to speed up build times, but my build times instead went from 3-4 minutes to 6-7 minutes.
I’ve tried to iron out where the problem comes from and found some interesting road blocks:
1. The node_modules are not being cached anymore:
3:56:29 PM: Started restoring cached node modules
3:56:29 PM: Finished restoring cached node modules
3:56:29 PM: Started restoring cached yarn cache
3:56:29 PM: Finished restoring cached yarn cache
3:56:29 PM: Installing NPM modules using Yarn version 1.17.0
3:56:30 PM: yarn install v1.17.0
3:56:30 PM: [1/4] Resolving packages...
3:56:31 PM: [2/4] Fetching packages...
3:57:02 PM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
3:57:02 PM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
3:57:02 PM: info fsevents@1.2.9: The platform "linux" is incompatible with this module.
3:57:02 PM: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
3:57:02 PM: [3/4] Linking dependencies...
3:57:02 PM: warning "gatsby > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
3:57:02 PM: warning "gatsby-plugin-sass > sass-loader@7.3.1" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
3:57:02 PM: warning " > react-moment@0.9.7" has unmet peer dependency "moment@^2.24.0".
3:57:26 PM: [4/4] Building fresh packages...
3:57:32 PM: Done in 61.65s.
2. It needs to install the same build plugin on each build and it takes over 1 minute. can this be cached or stored in the project?
3:57:34 PM: ❯ Installing plugins
3:57:34 PM: - netlify-plugin-gatsby-cache
3:58:44 PM:
3:58:44 PM: ❯ Loading plugins
3:58:44 PM: - netlify-plugin-gatsby-cache@0.2.1
Edit: Okay problem number two went away when saving the plugin locally in my project. 1 min less
Edit 2: Problem number one also solved by matching the yarn version in the build to my local one