We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 873b14a commit 8fbeb31Copy full SHA for 8fbeb31
src/build/cache.ts
@@ -1,3 +1,4 @@
1
+import { existsSync } from 'node:fs'
2
import { join } from 'node:path'
3
4
import type { PluginContext } from './plugin-context.js'
@@ -11,7 +12,11 @@ export const saveBuildCache = async (ctx: PluginContext) => {
11
12
}
13
14
export const restoreBuildCache = async (ctx: PluginContext) => {
- if (await ctx.utils.cache.restore(join(ctx.publishDir, 'cache'))) {
15
+ const { cache } = ctx.utils
16
+
17
+ if (existsSync(join(ctx.publishDir, 'cache'))) {
18
+ console.log('Next.js cache found.')
19
+ } else if (await cache.restore(join(ctx.publishDir, 'cache'))) {
20
console.log('Next.js cache restored.')
21
} else {
22
console.log('No Next.js cache to restore.')
0 commit comments