diff --git a/packages/nuxi/src/commands/build.ts b/packages/nuxi/src/commands/build.ts index 2793f31ad4..3258a5a2b8 100644 --- a/packages/nuxi/src/commands/build.ts +++ b/packages/nuxi/src/commands/build.ts @@ -27,11 +27,6 @@ export default defineNuxtCommand({ cwd: rootDir, fileName: args.dotenv }, - defaults: { - experimental: { - payloadExtraction: args.prerender ? true : undefined - } - }, overrides: { logLevel: args['log-level'], _generate: args.prerender diff --git a/packages/nuxt/src/core/nuxt.ts b/packages/nuxt/src/core/nuxt.ts index ec6dcf52e4..19db1559cd 100644 --- a/packages/nuxt/src/core/nuxt.ts +++ b/packages/nuxt/src/core/nuxt.ts @@ -243,6 +243,10 @@ async function initNuxt (nuxt: Nuxt) { } // Add prerender payload support + if (nuxt.options._generate && nuxt.options.experimental.payloadExtraction === undefined) { + console.warn('Using experimental payload extraction for full-static output. You can opt-out by setting `experimental.payloadExtraction` to `false`.') + nuxt.options.experimental.payloadExtraction = true + } if (!nuxt.options.dev && nuxt.options.experimental.payloadExtraction) { addPlugin(resolve(nuxt.options.appDir, 'plugins/payload.client')) } diff --git a/packages/schema/src/config/experimental.ts b/packages/schema/src/config/experimental.ts index 30438eab2e..a92cf33b37 100644 --- a/packages/schema/src/config/experimental.ts +++ b/packages/schema/src/config/experimental.ts @@ -117,15 +117,7 @@ export default defineUntypedSchema({ /** * When this option is enabled (by default) payload of pages generated with `nuxt generate` are extracted */ - payloadExtraction: { - async $resolve(enabled, get) { - enabled = enabled ?? false - if (enabled) { - console.warn('Using experimental payload extraction for full-static output. You can opt-out by setting `experimental.payloadExtraction` to `false`.') - } - return enabled - } - }, + payloadExtraction: undefined, /** * Whether to enable the experimental `` component for rendering content on the client