mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): work around payload extraction issue (#22162)
Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
parent
bea6ed1d9c
commit
4b6f3e1ba1
@ -191,7 +191,6 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||
'process.env.NUXT_EARLY_HINTS': nuxt.options.experimental.writeEarlyHints !== false,
|
||||
'process.env.NUXT_NO_SCRIPTS': !!nuxt.options.experimental.noScripts && !nuxt.options.dev,
|
||||
'process.env.NUXT_INLINE_STYLES': !!nuxt.options.experimental.inlineSSRStyles,
|
||||
'process.env.NUXT_PAYLOAD_EXTRACTION': !!nuxt.options.experimental.payloadExtraction,
|
||||
'process.env.NUXT_JSON_PAYLOADS': !!nuxt.options.experimental.renderJsonPayloads,
|
||||
'process.env.NUXT_COMPONENT_ISLANDS': !!nuxt.options.experimental.componentIslands,
|
||||
'process.dev': nuxt.options.dev,
|
||||
|
@ -374,10 +374,14 @@ async function initNuxt (nuxt: Nuxt) {
|
||||
|
||||
// TODO: remove when app manifest support is landed in https://github.com/nuxt/nuxt/pull/21641
|
||||
// Add prerender payload support
|
||||
if (useNitro().options.static && nuxt.options.experimental.payloadExtraction === undefined) {
|
||||
const nitro = useNitro()
|
||||
if (nitro.options.static && 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
|
||||
}
|
||||
nitro.options.replace['process.env.NUXT_PAYLOAD_EXTRACTION'] = String(!!nuxt.options.experimental.payloadExtraction)
|
||||
nitro.options._config.replace!['process.env.NUXT_PAYLOAD_EXTRACTION'] = String(!!nuxt.options.experimental.payloadExtraction)
|
||||
|
||||
if (!nuxt.options.dev && nuxt.options.experimental.payloadExtraction) {
|
||||
addPlugin(resolve(nuxt.options.appDir, 'plugins/payload.client'))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user