Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions packages/nuxi/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions packages/nuxt/src/core/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
}
Expand Down
10 changes: 1 addition & 9 deletions packages/schema/src/config/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down