mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
feat(config): add configOverrides for loadNuxt and loadNuxtConf… (#7263)
This commit is contained in:
parent
5d5d951772
commit
1ce8041abe
@ -12,6 +12,7 @@
|
||||
"dependencies": {
|
||||
"@nuxt/utils": "2.12.1",
|
||||
"consola": "^2.11.3",
|
||||
"defu": "^2.0.2",
|
||||
"esm": "^3.2.25",
|
||||
"std-env": "^2.2.1"
|
||||
},
|
||||
|
@ -1,4 +1,5 @@
|
||||
import path from 'path'
|
||||
import defu from 'defu'
|
||||
import consola from 'consola'
|
||||
import { clearRequireCache, scanRequireTree } from '@nuxt/utils'
|
||||
import esm from 'esm'
|
||||
@ -7,7 +8,8 @@ import { defaultNuxtConfigFile } from './config'
|
||||
export async function loadNuxtConfig ({
|
||||
rootDir = '.',
|
||||
configFile = defaultNuxtConfigFile,
|
||||
configContext = {}
|
||||
configContext = {},
|
||||
configOverrides = {}
|
||||
} = {}) {
|
||||
rootDir = path.resolve(rootDir)
|
||||
|
||||
@ -48,7 +50,7 @@ export async function loadNuxtConfig ({
|
||||
}
|
||||
|
||||
// Don't mutate options export
|
||||
options = Object.assign({}, options)
|
||||
options = defu(configOverrides, options)
|
||||
|
||||
// Keep _nuxtConfigFile for watching
|
||||
options._nuxtConfigFile = configFile
|
||||
|
@ -1,7 +1,7 @@
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import defaultsDeep from 'lodash/defaultsDeep'
|
||||
import defaults from 'lodash/defaults'
|
||||
import defu from 'defu'
|
||||
import pick from 'lodash/pick'
|
||||
import uniq from 'lodash/uniq'
|
||||
import consola from 'consola'
|
||||
@ -237,7 +237,7 @@ export function getNuxtConfig (_options) {
|
||||
|
||||
// Apply default hash to CSP option
|
||||
if (options.render.csp) {
|
||||
options.render.csp = defaults({}, options.render.csp, {
|
||||
options.render.csp = defu(options.render.csp, {
|
||||
hashAlgorithm: 'sha256',
|
||||
allowedSources: undefined,
|
||||
policies: undefined,
|
||||
|
Loading…
Reference in New Issue
Block a user