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 Nov 15, 2022
1 parent fddc8b2 commit 6e78f9d
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 6e78f9d

Please sign in to comment.