mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +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,
|
||||
devHandlers: [],
|
||||
baseURL: nuxt.options.app.baseURL,
|
||||
virtual: {},
|
||||
runtimeConfig: {
|
||||
...nuxt.options.runtimeConfig,
|
||||
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
|
||||
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)
|
||||
|
||||
// @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 --
|
||||
const getSSRRenderer = lazyCachedFunction(async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user