mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nitro): pass resolved handlers to the nitro config (#4263)
This commit is contained in:
parent
2ca704641b
commit
0d5ec20a4b
@ -56,6 +56,9 @@ export async function setupNitroBridge () {
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve Handlers
|
||||
const { handlers, devHandlers } = await resolveHandlers(nuxt)
|
||||
|
||||
// Resolve config
|
||||
const _nitroConfig = (nuxt.options as any).nitro || {} as NitroConfig
|
||||
const nitroConfig: NitroConfig = defu(_nitroConfig, <NitroConfig>{
|
||||
@ -67,7 +70,7 @@ export async function setupNitroBridge () {
|
||||
scanDirs: nuxt.options._layers.map(layer => join(layer.config.srcDir, 'server')),
|
||||
renderer: resolve(distDir, 'runtime/nitro/renderer'),
|
||||
nodeModulesDirs: nuxt.options.modulesDir,
|
||||
handlers: [],
|
||||
handlers,
|
||||
devHandlers: [],
|
||||
runtimeConfig: {
|
||||
...nuxt.options.runtimeConfig,
|
||||
@ -231,8 +234,6 @@ export async function setupNitroBridge () {
|
||||
// Setup handlers
|
||||
const devMidlewareHandler = dynamicEventHandler()
|
||||
nitro.options.devHandlers.unshift({ handler: devMidlewareHandler })
|
||||
const { handlers, devHandlers } = await resolveHandlers(nuxt)
|
||||
nitro.options.handlers.push(...handlers)
|
||||
nitro.options.devHandlers.push(...devHandlers)
|
||||
nitro.options.handlers.unshift({
|
||||
route: '/__nuxt_error',
|
||||
|
@ -12,6 +12,9 @@ import { distDir } from '../dirs'
|
||||
import { ImportProtectionPlugin } from './plugins/import-protection'
|
||||
|
||||
export async function initNitro (nuxt: Nuxt) {
|
||||
// Resolve handlers
|
||||
const { handlers, devHandlers } = await resolveHandlers(nuxt)
|
||||
|
||||
// Resolve config
|
||||
const _nitroConfig = ((nuxt.options as any).nitro || {}) as NitroConfig
|
||||
const nitroConfig: NitroConfig = defu(_nitroConfig, <NitroConfig>{
|
||||
@ -23,7 +26,7 @@ export async function initNitro (nuxt: Nuxt) {
|
||||
scanDirs: nuxt.options._layers.map(layer => join(layer.config.srcDir, 'server')),
|
||||
renderer: resolve(distDir, 'core/runtime/nitro/renderer'),
|
||||
nodeModulesDirs: nuxt.options.modulesDir,
|
||||
handlers: [],
|
||||
handlers,
|
||||
devHandlers: [],
|
||||
baseURL: nuxt.options.app.baseURL,
|
||||
runtimeConfig: {
|
||||
@ -117,8 +120,6 @@ export async function initNitro (nuxt: Nuxt) {
|
||||
// Setup handlers
|
||||
const devMidlewareHandler = dynamicEventHandler()
|
||||
nitro.options.devHandlers.unshift({ handler: devMidlewareHandler })
|
||||
const { handlers, devHandlers } = await resolveHandlers(nuxt)
|
||||
nitro.options.handlers.push(...handlers)
|
||||
nitro.options.devHandlers.push(...devHandlers)
|
||||
nitro.options.handlers.unshift({
|
||||
route: '/__nuxt_error',
|
||||
|
Loading…
Reference in New Issue
Block a user