perf(nuxt): don't add client fallback plugin if not enabled (#26666)

This commit is contained in:
Julien Huang 2024-04-06 17:15:47 +02:00 committed by GitHub
parent 7dcd9e2a2d
commit bfb7eeac07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -222,10 +222,12 @@ export default defineNuxtModule<ComponentsOptions>({
getComponents, getComponents,
})) }))
} }
if (nuxt.options.experimental.clientFallback) {
config.plugins.push(clientFallbackAutoIdPlugin.vite({ config.plugins.push(clientFallbackAutoIdPlugin.vite({
sourcemap: !!nuxt.options.sourcemap[mode], sourcemap: !!nuxt.options.sourcemap[mode],
rootDir: nuxt.options.rootDir, rootDir: nuxt.options.rootDir,
})) }))
}
config.plugins.push(loaderPlugin.vite({ config.plugins.push(loaderPlugin.vite({
sourcemap: !!nuxt.options.sourcemap[mode], sourcemap: !!nuxt.options.sourcemap[mode],
getComponents, getComponents,
@ -291,10 +293,12 @@ export default defineNuxtModule<ComponentsOptions>({
getComponents, getComponents,
})) }))
} }
if (nuxt.options.experimental.clientFallback) {
config.plugins.push(clientFallbackAutoIdPlugin.webpack({ config.plugins.push(clientFallbackAutoIdPlugin.webpack({
sourcemap: !!nuxt.options.sourcemap[mode], sourcemap: !!nuxt.options.sourcemap[mode],
rootDir: nuxt.options.rootDir, rootDir: nuxt.options.rootDir,
})) }))
}
config.plugins.push(loaderPlugin.webpack({ config.plugins.push(loaderPlugin.webpack({
sourcemap: !!nuxt.options.sourcemap[mode], sourcemap: !!nuxt.options.sourcemap[mode],
getComponents, getComponents,