Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): remove unsupported nullish coalescing #9322

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/config/src/load.js
Expand Up @@ -8,6 +8,14 @@ import destr from 'destr'
import * as rc from 'rc9'
import { defaultNuxtConfigFile } from './config'

function coalesce (...values) {
danielroe marked this conversation as resolved.
Show resolved Hide resolved
const value = values.shift()
if (!values.length || (value !== null && value !== undefined)) {
return value
}
return coalesce(...values)
}

export async function loadNuxtConfig ({
rootDir = '.',
envConfig = {},
Expand Down Expand Up @@ -89,8 +97,8 @@ export async function loadNuxtConfig ({

// Load Combine configs
// Priority: configOverrides > nuxtConfig > .nuxt/dist/nuxtrc > .nuxtrc > .nuxtrc (global)
const dev = configOverrides.dev ?? options.dev ?? configContext.dev
const buildDir = configOverrides.buildDir ?? options.buildDir ?? configContext.buildDir ?? '.nuxt'
const dev = coalesce(configOverrides.dev, options.dev, configContext.dev)
const buildDir = coalesce(configOverrides.buildDir, options.buildDir, configContext.buildDir, '.nuxt')
options = defu(
configOverrides,
options,
Expand Down