Skip to content

Commit

Permalink
fix: insert stub virtual file for server when ssr: false
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jul 8, 2022
1 parent eaf8f18 commit 2f967e9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export async function setupNitroBridge () {
nodeModulesDirs: nuxt.options.modulesDir,
handlers: [],
devHandlers: [],
virtual: {},
runtimeConfig: {
...nuxt.options.runtimeConfig,
nitro: {
Expand Down Expand Up @@ -124,10 +125,18 @@ export async function setupNitroBridge () {
...nuxt.options.alias
},
replace: {
'process.env.NUXT_NO_SSR': nuxt.options.ssr === false ? true : undefined
'process.env.NUXT_NO_SSR': nuxt.options.ssr === false
},
rollupConfig: {
plugins: []
}
})

// Add fallback server for `ssr: false`
if (!nuxt.options.ssr) {
nitroConfig.virtual['#build/dist/server/server.mjs'] = 'export default () => {}'
}

// Let nitro handle #build for windows path normalization
delete nitroConfig.alias['#build']

Expand Down

0 comments on commit 2f967e9

Please sign in to comment.