Skip to content

Commit 9fbac50

Browse files
herecydevpieh
andauthored
Add additional logging around conditional page builds (#26748)
* Add additional logging * Only log if there was a cached hash * NIT: missing brackets (just for code uniformity, doesn't functionally change anything) * NIT: bit nicer indentation Co-authored-by: Michal Piechowiak <[email protected]>
1 parent bf7d633 commit 9fbac50

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

packages/gatsby/src/commands/build.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,22 @@ module.exports = async function build(program: IBuildArgs): Promise<void> {
209209

210210
// Rebuild subset of pages if user opt into GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES
211211
// if there were no source files (for example components, static queries, etc) changes since last build, otherwise rebuild all pages
212-
if (
213-
process.env.GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES &&
214-
cachedWebpackCompilationHash === store.getState().webpackCompilationHash
215-
) {
216-
pagePaths = buildUtils.getChangedPageDataKeys(
217-
store.getState(),
218-
cachedPageData
219-
)
212+
if (process.env.GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES) {
213+
if (
214+
cachedWebpackCompilationHash === store.getState().webpackCompilationHash
215+
) {
216+
pagePaths = buildUtils.getChangedPageDataKeys(
217+
store.getState(),
218+
cachedPageData
219+
)
220+
} else if (cachedWebpackCompilationHash) {
221+
report.info(
222+
report.stripIndent(`
223+
One or more of your source files have changed since the last time you ran Gatsby. All
224+
pages will be rebuilt.
225+
`)
226+
)
227+
}
220228
}
221229

222230
const buildHTMLActivityProgress = report.createProgress(

0 commit comments

Comments
 (0)