mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 15:50:32 +00:00
fix(nuxt): use virtual server stub with ssr: false
(#5773)
This commit is contained in:
parent
079ff4439c
commit
f321a56e63
@ -29,6 +29,7 @@ export async function initNitro (nuxt: Nuxt) {
|
|||||||
handlers,
|
handlers,
|
||||||
devHandlers: [],
|
devHandlers: [],
|
||||||
baseURL: nuxt.options.app.baseURL,
|
baseURL: nuxt.options.app.baseURL,
|
||||||
|
virtual: {},
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
...nuxt.options.runtimeConfig,
|
...nuxt.options.runtimeConfig,
|
||||||
nitro: {
|
nitro: {
|
||||||
@ -100,6 +101,11 @@ export async function initNitro (nuxt: Nuxt) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Add fallback server for `ssr: false`
|
||||||
|
if (!nuxt.options.ssr) {
|
||||||
|
nitroConfig.virtual['#build/dist/server/server.mjs'] = 'export default () => {}'
|
||||||
|
}
|
||||||
|
|
||||||
// Extend nitro config with hook
|
// Extend nitro config with hook
|
||||||
await nuxt.callHook('nitro:config', nitroConfig)
|
await nuxt.callHook('nitro:config', nitroConfig)
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ const getClientManifest = () => import('#build/dist/server/client.manifest.mjs')
|
|||||||
.then(r => typeof r === 'function' ? r() : r)
|
.then(r => typeof r === 'function' ? r() : r)
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const getServerEntry = () => process.env.NUXT_NO_SSR ? Promise.resolve(null) : import('#build/dist/server/server.mjs').then(r => r.default || r)
|
const getServerEntry = () => import('#build/dist/server/server.mjs').then(r => r.default || r)
|
||||||
|
|
||||||
// -- SSR Renderer --
|
// -- SSR Renderer --
|
||||||
const getSSRRenderer = lazyCachedFunction(async () => {
|
const getSSRRenderer = lazyCachedFunction(async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user