Skip to content

Commit a4c49e2

Browse files
authoredJan 24, 2024
fix: only populate build cache when run inside buildbot (#199)
1 parent 97af130 commit a4c49e2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import { PluginContext } from './build/plugin-context.js'
1818
export const onPreBuild = async (options: NetlifyPluginOptions) => {
1919
// Enable Next.js standalone mode at build time
2020
process.env.NEXT_PRIVATE_STANDALONE = 'true'
21-
await restoreBuildCache(new PluginContext(options))
21+
if (!options.constants.IS_LOCAL) {
22+
await restoreBuildCache(new PluginContext(options))
23+
}
2224
}
2325

2426
export const onBuild = async (options: NetlifyPluginOptions) => {
@@ -27,7 +29,11 @@ export const onBuild = async (options: NetlifyPluginOptions) => {
2729
ctx.failBuild('Publish directory not found, please check your netlify.toml')
2830
}
2931
await setImageConfig(ctx)
30-
await saveBuildCache(ctx)
32+
33+
// only save the build cache if not run via the CLI
34+
if (!options.constants.IS_LOCAL) {
35+
await saveBuildCache(ctx)
36+
}
3137

3238
await Promise.all([
3339
copyStaticAssets(ctx),

0 commit comments

Comments
 (0)
Please sign in to comment.