Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (typeof options.layoutTransition === 'string') {
options.layoutTransition = { name: options.layoutTransition }
}
if (typeof options.extensions === 'string') {
options.extensions = [options.extensions]
}
options.globalName = (isNonEmptyString(options.globalName) && /^[a-zA-Z]+$/.test(options.globalName))
? options.globalName.toLowerCase()
: `nuxt`
// Resolve rootDir
options.rootDir = isNonEmptyString(options.rootDir) ? path.resolve(options.rootDir) : process.cwd()
// Apply defaults by ${buildDir}/dist/build.config.js
// TODO: Unsafe operation.
// const buildDir = options.buildDir || defaults.buildDir
// const buildConfig = resolve(options.rootDir, buildDir, 'build.config.js')
// if (existsSync(buildConfig)) {
// defaultsDeep(options, require(buildConfig))
// }
// Apply defaults
const nuxtConfig = getDefaultNuxtConfig()
nuxtConfig.build._publicPath = nuxtConfig.build.publicPath
// Fall back to default if publicPath is falsy
if (options.build && !options.build.publicPath) {
nuxtConfig.build._publicPath = nuxtConfig.build.publicPath
// Fall back to default if publicPath is falsy
if (options.build && !options.build.publicPath) {
options.build.publicPath = undefined
}
defaultsDeep(options, nuxtConfig)
// Sanitize router.base
if (!/\/$/.test(options.router.base)) {
options.router.base += '/'
}
// Check srcDir and generate.dir existence
const hasSrcDir = isNonEmptyString(options.srcDir)
const hasGenerateDir = isNonEmptyString(options.generate.dir)
// Resolve srcDir
options.srcDir = hasSrcDir
? path.resolve(options.rootDir, options.srcDir)
: options.rootDir
// Resolve buildDir
options.buildDir = path.resolve(options.rootDir, options.buildDir)
// Aliases
const { rootDir, srcDir, dir: { assets: assetsDir, static: staticDir } } = options
options.alias = {
'~~': rootDir,
'@@': rootDir,
'~': srcDir,
delete options.transition
}
if (typeof options.pageTransition === 'string') {
options.pageTransition = { name: options.pageTransition }
}
if (typeof options.layoutTransition === 'string') {
options.layoutTransition = { name: options.layoutTransition }
}
if (typeof options.extensions === 'string') {
options.extensions = [options.extensions]
}
options.globalName = (isNonEmptyString(options.globalName) && /^[a-zA-Z]+$/.test(options.globalName))
? options.globalName.toLowerCase()
: `nuxt`
// Resolve rootDir
options.rootDir = isNonEmptyString(options.rootDir) ? path.resolve(options.rootDir) : process.cwd()
// Apply defaults by ${buildDir}/dist/build.config.js
// TODO: Unsafe operation.
// const buildDir = options.buildDir || defaults.buildDir
// const buildConfig = resolve(options.rootDir, buildDir, 'build.config.js')
// if (existsSync(buildConfig)) {
// defaultsDeep(options, require(buildConfig))
// }
// Apply defaults
const nuxtConfig = getDefaultNuxtConfig()
// Fall back to default if publicPath is falsy
if (options.build && !options.build.publicPath) {
options.build.publicPath = undefined
}
defaultsDeep(options, nuxtConfig)
// Sanitize router.base
if (!/\/$/.test(options.router.base)) {
options.router.base += '/'
}
// Check srcDir and generate.dir existence
const hasSrcDir = isNonEmptyString(options.srcDir)
const hasGenerateDir = isNonEmptyString(options.generate.dir)
// Resolve srcDir
options.srcDir = hasSrcDir
? path.resolve(options.rootDir, options.srcDir)
: options.rootDir
// Resolve buildDir
options.buildDir = path.resolve(options.rootDir, options.buildDir)
// Aliases
const { rootDir, srcDir, dir: { assets: assetsDir, static: staticDir } } = options
options.alias = {
'~~': rootDir,
'@@': rootDir,
'~': srcDir,
'@': srcDir,