mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 15:42:09 +00:00
fix(nuxt): allow disabling early hints (#8264)
This commit is contained in:
parent
a90b303d97
commit
96a8807abf
@ -99,6 +99,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
|||||||
},
|
},
|
||||||
replace: {
|
replace: {
|
||||||
'process.env.NUXT_NO_SSR': nuxt.options.ssr === false,
|
'process.env.NUXT_NO_SSR': nuxt.options.ssr === false,
|
||||||
|
'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_NO_SCRIPTS': !!nuxt.options.experimental.noScripts && !nuxt.options.dev,
|
||||||
'process.env.NUXT_INLINE_STYLES': !!nuxt.options.experimental.inlineSSRStyles,
|
'process.env.NUXT_INLINE_STYLES': !!nuxt.options.experimental.inlineSSRStyles,
|
||||||
'process.env.NUXT_PAYLOAD_EXTRACTION': !!nuxt.options.experimental.payloadExtraction,
|
'process.env.NUXT_PAYLOAD_EXTRACTION': !!nuxt.options.experimental.payloadExtraction,
|
||||||
|
@ -157,7 +157,7 @@ export default defineRenderHandler(async (event) => {
|
|||||||
const renderer = (process.env.NUXT_NO_SSR || ssrContext.noSSR) ? await getSPARenderer() : await getSSRRenderer()
|
const renderer = (process.env.NUXT_NO_SSR || ssrContext.noSSR) ? await getSPARenderer() : await getSSRRenderer()
|
||||||
|
|
||||||
// Render 103 Early Hints
|
// Render 103 Early Hints
|
||||||
if (!isRenderingPayload && !process.env.prerender) {
|
if (process.env.NUXT_EARLY_HINTS && !isRenderingPayload && !process.env.prerender) {
|
||||||
const { link } = renderResourceHeaders({}, renderer.rendererContext)
|
const { link } = renderResourceHeaders({}, renderer.rendererContext)
|
||||||
writeEarlyHints(event, link)
|
writeEarlyHints(event, link)
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,9 @@ export default defineUntypedSchema({
|
|||||||
payloadExtraction: true,
|
payloadExtraction: true,
|
||||||
|
|
||||||
/** Enable cross-origin prefetch using the Speculation Rules API. */
|
/** Enable cross-origin prefetch using the Speculation Rules API. */
|
||||||
crossOriginPrefetch: false
|
crossOriginPrefetch: false,
|
||||||
|
|
||||||
|
/** Write early hints when using node server */
|
||||||
|
writeEarlyHints: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user