From 5d5183ee82f0d1567934c9cd13160bf84bddd8d3 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sun, 4 Apr 2021 14:28:55 +0200 Subject: [PATCH] perf(webpack): use fs cache by default --- packages/webpack/src/presets/base.ts | 16 ++++++++++------ playground/nuxt.config.ts | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/webpack/src/presets/base.ts b/packages/webpack/src/presets/base.ts index 9861670b54..d9277df64f 100644 --- a/packages/webpack/src/presets/base.ts +++ b/packages/webpack/src/presets/base.ts @@ -164,18 +164,22 @@ export function baseTranspile (ctx: WebpackConfigContext) { function getCache (ctx: WebpackConfigContext): Configuration['cache'] { const { options } = ctx - if (!options.build.cache) { + if (!options.dev) { return false } return { + name: ctx.name, type: 'filesystem', - cacheDirectory: resolve('node_modules/.cache/@nuxt/webpack/'), + cacheDirectory: resolve(ctx.options.rootDir, 'node_modules/.cache/webpack'), + managedPaths: [ + ...ctx.options.modulesDir + ], buildDependencies: { - config: [...options._nuxtConfigFiles] - }, - ...(options.build.cache as any), - name + config: [ + ...ctx.options._nuxtConfigFiles + ] + } } } diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts index 70d274d93d..15046bd316 100644 --- a/playground/nuxt.config.ts +++ b/playground/nuxt.config.ts @@ -1,5 +1,5 @@ import { defineNuxtConfig } from '@nuxt/kit' export default defineNuxtConfig({ - vite: true + vite: false })