When I run the build for Gatsby project it is taking more than 1.30 HR because of lot of lot of dynamic pages. My question is when I make a change on a particular page or pages Is it possible to run the build for the particular changes?
For gatsby develop
try using Gatsby flags . Used like this in the gatsby-config.js
:
module.exports = {
flags: {
FAST_DEV: true,
},
}
You can find a full detailed explanation of the current available flags at: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/utils/flags.ts
In your case, try using FAST_DEV
which includes PRESERVE_FILE_DOWNLOAD_CACHE
and DEV_WEBPACK_CACHE
flags respectively.
For gatsby build
I think you are looking for a feature called Incremental Builds: which basically only builds the pages that have changed from the last deployment.
Depending on your deploy server there's a different implementation way:
Netlify: https://www.netlify.com/blog/2020/04/23/enable-gatsby-incremental-builds-on.netlify/
Gatsby Cloud: https://www.gatsbyjs.com/blog/2020-04-22-announcing-incremental-builds/
Custom implementation: this is difficult to handle without a server implementation, which will be different in each case (and details have not been provided in the question). Try adapting Netlify's answer by enabling GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES
and `cross-env , leaving your deploy command like:
"build": "cross-env GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.