mirror of https://github.com/nuxt/nuxt.git
fix(nuxt): add `payload.client` plugin only for production build (#7498)
This commit is contained in:
parent
ac0b3a63a2
commit
9024d76165
|
@ -2,7 +2,7 @@ import { defineNuxtPlugin, loadPayload, addRouteMiddleware, isPrerendered } from
|
||||||
|
|
||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
// Only enable behavior if initial page is prerendered
|
// Only enable behavior if initial page is prerendered
|
||||||
// TOOD: Support hybrid
|
// TOOD: Support hybrid and dev
|
||||||
if (!isPrerendered()) {
|
if (!isPrerendered()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,9 @@ async function initNuxt (nuxt: Nuxt) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Add prerender payload support
|
// Add prerender payload support
|
||||||
|
if (!nuxt.options.dev) {
|
||||||
addPlugin(resolve(nuxt.options.appDir, 'plugins/payload.client'))
|
addPlugin(resolve(nuxt.options.appDir, 'plugins/payload.client'))
|
||||||
|
}
|
||||||
|
|
||||||
// Track components used to render for webpack
|
// Track components used to render for webpack
|
||||||
if (nuxt.options.builder === '@nuxt/webpack-builder') {
|
if (nuxt.options.builder === '@nuxt/webpack-builder') {
|
||||||
|
|
Loading…
Reference in New Issue