mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
chore(config): warn on unknown mode (#4303)
This commit is contained in:
parent
f9b199873f
commit
d280bd8d5b
@ -237,7 +237,11 @@ export function getNuxtConfig(_options) {
|
||||
|
||||
// Apply mode preset
|
||||
const modePreset = options.modes[options.mode || 'universal']
|
||||
defaultsDeep(options, modePreset)
|
||||
|
||||
if (!modePreset) {
|
||||
consola.warn(`Unknown mode: ${options.mode}. Falling back to universal`)
|
||||
}
|
||||
defaultsDeep(options, modePreset || options.modes.universal)
|
||||
|
||||
if (options.modern === true) {
|
||||
options.modern = 'server'
|
||||
|
1
test/fixtures/with-config/nuxt.config.js
vendored
1
test/fixtures/with-config/nuxt.config.js
vendored
@ -2,6 +2,7 @@ import path from 'path'
|
||||
import compression from 'compression'
|
||||
|
||||
export default {
|
||||
mode: 'unknown',
|
||||
srcDir: __dirname,
|
||||
server: {
|
||||
port: 8000,
|
||||
|
@ -14,9 +14,12 @@ const hooks = [
|
||||
|
||||
describe('with-config', () => {
|
||||
buildFixture('with-config', () => {
|
||||
expect(consola.warn).toHaveBeenCalledTimes(3)
|
||||
expect(consola.warn).toHaveBeenCalledTimes(4)
|
||||
expect(consola.fatal).toHaveBeenCalledTimes(0)
|
||||
expect(consola.warn.mock.calls).toMatchObject([
|
||||
[
|
||||
'Unknown mode: unknown. Falling back to universal'
|
||||
],
|
||||
[{
|
||||
message: 'Found 2 plugins that match the configuration, suggest to specify extension:',
|
||||
additional: expect.stringContaining('plugins/test.json')
|
||||
|
Loading…
Reference in New Issue
Block a user