mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
perf(nuxt): experimentally disable vue server renderer nitro endpoint (#19825)
This commit is contained in:
parent
fc9c3803b8
commit
562cef24ca
@ -232,6 +232,19 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
|||||||
handler: resolve(distDir, 'core/runtime/nitro/renderer')
|
handler: resolve(distDir, 'core/runtime/nitro/renderer')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (nuxt.options.experimental.noVueServer) {
|
||||||
|
nitro.hooks.hook('rollup:before', (nitro) => {
|
||||||
|
if (nitro.options.preset === 'nitro-prerender') { return }
|
||||||
|
const nuxtErrorHandler = nitro.options.handlers.findIndex(h => h.route === '/__nuxt_error')
|
||||||
|
if (nuxtErrorHandler >= 0) {
|
||||||
|
nitro.options.handlers.splice(nuxtErrorHandler, 1)
|
||||||
|
}
|
||||||
|
// @ts-expect-error TODO: https://github.com/unjs/nitro/pull/1069
|
||||||
|
nitro.options.renderer = undefined
|
||||||
|
nitro.options.errorHandler = '#internal/nitro/error'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Add typed route responses
|
// Add typed route responses
|
||||||
nuxt.hook('prepare:types', async (opts) => {
|
nuxt.hook('prepare:types', async (opts) => {
|
||||||
if (!nuxt.options.dev) {
|
if (!nuxt.options.dev) {
|
||||||
@ -261,7 +274,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
|||||||
} else {
|
} else {
|
||||||
const distDir = resolve(nuxt.options.rootDir, 'dist')
|
const distDir = resolve(nuxt.options.rootDir, 'dist')
|
||||||
if (!existsSync(distDir)) {
|
if (!existsSync(distDir)) {
|
||||||
await fsp.symlink(nitro.options.output.publicDir, distDir, 'junction').catch(() => { })
|
await fsp.symlink(nitro.options.output.publicDir, distDir, 'junction').catch(() => {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ export default defineUntypedSchema({
|
|||||||
* @type {boolean | ((id?: string) => boolean)}
|
* @type {boolean | ((id?: string) => boolean)}
|
||||||
*/
|
*/
|
||||||
inlineSSRStyles: {
|
inlineSSRStyles: {
|
||||||
async $resolve(val, get) {
|
async $resolve (val, get) {
|
||||||
if (val === false || (await get('dev')) || (await get('ssr')) === false || (await get('builder')) === '@nuxt/webpack-builder') {
|
if (val === false || (await get('dev')) || (await get('ssr')) === false || (await get('builder')) === '@nuxt/webpack-builder') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -114,6 +114,11 @@ export default defineUntypedSchema({
|
|||||||
*/
|
*/
|
||||||
noScripts: false,
|
noScripts: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable vue server renderer endpoint within nitro.
|
||||||
|
*/
|
||||||
|
noVueServer: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When this option is enabled (by default) payload of pages generated with `nuxt generate` are extracted
|
* When this option is enabled (by default) payload of pages generated with `nuxt generate` are extracted
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user