fix(schema): show payloadExtraction warning only when unset (#18516)

Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
Hyunseung Lee 2023-03-13 20:06:43 +09:00 committed by GitHub
parent ce45590120
commit e42d63a25a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 14 deletions

View File

@ -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

View File

@ -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'))
}

View File

@ -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 `<NuxtClientFallback>` component for rendering content on the client