Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): add payload.client plugin only for production build (#7498)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 14, 2022
1 parent ac0b3a6 commit 9024d76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/plugins/payload.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineNuxtPlugin, loadPayload, addRouteMiddleware, isPrerendered } from

export default defineNuxtPlugin((nuxtApp) => {
// Only enable behavior if initial page is prerendered
// TOOD: Support hybrid
// TOOD: Support hybrid and dev
if (!isPrerendered()) {
return
}
Expand Down
4 changes: 3 additions & 1 deletion packages/nuxt/src/core/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ async function initNuxt (nuxt: Nuxt) {
})

// Add prerender payload support
addPlugin(resolve(nuxt.options.appDir, 'plugins/payload.client'))
if (!nuxt.options.dev) {
addPlugin(resolve(nuxt.options.appDir, 'plugins/payload.client'))
}

// Track components used to render for webpack
if (nuxt.options.builder === '@nuxt/webpack-builder') {
Expand Down

0 comments on commit 9024d76

Please sign in to comment.