fix(nuxt)!: enable payload extraction only for nuxi generate (#9018)

This commit is contained in:
pooya parsa 2022-11-15 17:27:34 +01:00 committed by GitHub
parent fddc8b2e6e
commit 6e78f9dbb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -27,6 +27,11 @@ export default defineNuxtCommand({
cwd: rootDir,
fileName: args.dotenv
},
defaults: {
experimental: {
payloadExtraction: args.prerender ? true : undefined
}
},
overrides: {
_generate: args.prerender
}

View File

@ -77,7 +77,15 @@ export default defineUntypedSchema({
/**
* When this option is enabled (by default) payload of pages generated with `nuxt generate` are extracted
*/
payloadExtraction: true,
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
}
},
/** Enable cross-origin prefetch using the Speculation Rules API. */
crossOriginPrefetch: false,

View File

@ -105,7 +105,8 @@ export default defineNuxtConfig({
experimental: {
inlineSSRStyles: id => !!id && !id.includes('assets.vue'),
reactivityTransform: true,
treeshakeClientOnly: true
treeshakeClientOnly: true,
payloadExtraction: true
},
appConfig: {
fromNuxtConfig: true,