mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
fix(nuxt): set nitro log level to match nuxt options (#25213)
This commit is contained in:
parent
97db0fada7
commit
2de774d95a
@ -11,7 +11,7 @@ import escapeRE from 'escape-string-regexp'
|
|||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import fsExtra from 'fs-extra'
|
import fsExtra from 'fs-extra'
|
||||||
import { dynamicEventHandler } from 'h3'
|
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
|
// @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 { template as defaultSpaLoadingTemplate } from '@nuxt/ui-templates/templates/spa-loading-icon.mjs'
|
||||||
import { version as nuxtVersion } from '../../package.json'
|
import { version as nuxtVersion } from '../../package.json'
|
||||||
@ -19,6 +19,12 @@ import { distDir } from '../dirs'
|
|||||||
import { toArray } from '../utils'
|
import { toArray } from '../utils'
|
||||||
import { ImportProtectionPlugin, nuxtImportProtections } from './plugins/import-protection'
|
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 }) {
|
export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||||
// Resolve config
|
// Resolve config
|
||||||
const _nitroConfig = ((nuxt.options as any).nitro || {}) as NitroConfig
|
const _nitroConfig = ((nuxt.options as any).nitro || {}) as NitroConfig
|
||||||
@ -218,7 +224,8 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
|||||||
rollupConfig: {
|
rollupConfig: {
|
||||||
output: {},
|
output: {},
|
||||||
plugins: []
|
plugins: []
|
||||||
}
|
},
|
||||||
|
logLevel: logLevelMapReverse[nuxt.options.logLevel],
|
||||||
} satisfies NitroConfig)
|
} satisfies NitroConfig)
|
||||||
|
|
||||||
// Resolve user-provided paths
|
// Resolve user-provided paths
|
||||||
|
Loading…
Reference in New Issue
Block a user