Skip to content

Commit

Permalink
fix(nuxt): set nitro log level to match nuxt options (#25213)
Browse files Browse the repository at this point in the history
  • Loading branch information
kongmoumou committed Jan 15, 2024
1 parent 97db0fa commit 2de774d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/nuxt/src/core/nitro.ts
Expand Up @@ -11,14 +11,20 @@ import escapeRE from 'escape-string-regexp'
import { defu } from 'defu'
import fsExtra from 'fs-extra'
import { dynamicEventHandler } from 'h3'
import type { Nuxt, RuntimeConfig } from 'nuxt/schema'
import type { Nuxt, NuxtOptions, RuntimeConfig } from 'nuxt/schema'
// @ts-expect-error TODO: add legacy type support for subpath imports
import { template as defaultSpaLoadingTemplate } from '@nuxt/ui-templates/templates/spa-loading-icon.mjs'
import { version as nuxtVersion } from '../../package.json'
import { distDir } from '../dirs'
import { toArray } from '../utils'
import { ImportProtectionPlugin, nuxtImportProtections } from './plugins/import-protection'

const logLevelMapReverse = {
silent: 0,
info: 3,
verbose: 3
} satisfies Record<NuxtOptions['logLevel'], NitroConfig['logLevel']>

export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
// Resolve config
const _nitroConfig = ((nuxt.options as any).nitro || {}) as NitroConfig
Expand Down Expand Up @@ -218,7 +224,8 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
rollupConfig: {
output: {},
plugins: []
}
},
logLevel: logLevelMapReverse[nuxt.options.logLevel],
} satisfies NitroConfig)

// Resolve user-provided paths
Expand Down

0 comments on commit 2de774d

Please sign in to comment.