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

Commit

Permalink
fix(nuxt)!: enable payload extraction only for nuxi generate (#9018)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored and danielroe committed Jan 21, 2023
1 parent e4a8498 commit 3ef002c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/nuxi/src/commands/build.ts
Expand Up @@ -27,6 +27,11 @@ export default defineNuxtCommand({
cwd: rootDir,
fileName: args.dotenv
},
defaults: {
experimental: {
payloadExtraction: args.prerender ? true : undefined
}
},
overrides: {
_generate: args.prerender
}
Expand Down
10 changes: 9 additions & 1 deletion packages/schema/src/config/experimental.ts
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/basic/nuxt.config.ts
Expand Up @@ -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,
Expand Down

0 comments on commit 3ef002c

Please sign in to comment.