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

Commit

Permalink
fix(nuxt): allow disabling early hints (#8264)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 17, 2022
1 parent a90b303 commit 96a8807
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/nuxt/src/core/nitro.ts
Expand Up @@ -99,6 +99,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
},
replace: {
'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_INLINE_STYLES': !!nuxt.options.experimental.inlineSSRStyles,
'process.env.NUXT_PAYLOAD_EXTRACTION': !!nuxt.options.experimental.payloadExtraction,
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/core/runtime/nitro/renderer.ts
Expand Up @@ -157,7 +157,7 @@ export default defineRenderHandler(async (event) => {
const renderer = (process.env.NUXT_NO_SSR || ssrContext.noSSR) ? await getSPARenderer() : await getSSRRenderer()

// Render 103 Early Hints
if (!isRenderingPayload && !process.env.prerender) {
if (process.env.NUXT_EARLY_HINTS && !isRenderingPayload && !process.env.prerender) {
const { link } = renderResourceHeaders({}, renderer.rendererContext)
writeEarlyHints(event, link)
}
Expand Down
5 changes: 4 additions & 1 deletion packages/schema/src/config/experimental.ts
Expand Up @@ -81,6 +81,9 @@ export default defineUntypedSchema({
payloadExtraction: true,

/** Enable cross-origin prefetch using the Speculation Rules API. */
crossOriginPrefetch: false
crossOriginPrefetch: false,

/** Write early hints when using node server */
writeEarlyHints: true
}
})

0 comments on commit 96a8807

Please sign in to comment.