mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
perf(nuxt): render css/inline css higher than resource hints (#21793)
This commit is contained in:
parent
40fdff8b68
commit
dad633b658
@ -326,16 +326,25 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
||||
})
|
||||
}
|
||||
|
||||
// 2. Styles
|
||||
head.push({
|
||||
link: Object.values(styles)
|
||||
.map(resource =>
|
||||
({ rel: 'stylesheet', href: renderer.rendererContext.buildAssetsURL(resource.file) })
|
||||
),
|
||||
style: inlinedStyles
|
||||
})
|
||||
|
||||
if (!NO_SCRIPTS) {
|
||||
// 2. Resource Hints
|
||||
// @todo add priorities based on Capo
|
||||
// 3. Resource Hints
|
||||
// TODO: add priorities based on Capo
|
||||
head.push({
|
||||
link: getPreloadLinks(ssrContext, renderer.rendererContext) as Link[]
|
||||
})
|
||||
head.push({
|
||||
link: getPrefetchLinks(ssrContext, renderer.rendererContext) as Link[]
|
||||
})
|
||||
// 3. Payloads
|
||||
// 4. Payloads
|
||||
head.push({
|
||||
script: _PAYLOAD_EXTRACTION
|
||||
? process.env.NUXT_JSON_PAYLOADS
|
||||
@ -351,16 +360,7 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
||||
})
|
||||
}
|
||||
|
||||
// 4. Styles
|
||||
head.push({
|
||||
link: Object.values(styles)
|
||||
.map(resource =>
|
||||
({ rel: 'stylesheet', href: renderer.rendererContext.buildAssetsURL(resource.file) })
|
||||
),
|
||||
style: inlinedStyles
|
||||
})
|
||||
|
||||
// 4. Scripts
|
||||
// 5. Scripts
|
||||
if (!routeOptions.experimentalNoScripts) {
|
||||
head.push({
|
||||
script: Object.values(scripts).map(resource => (<Script> {
|
||||
|
Loading…
Reference in New Issue
Block a user