mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(generator): avoid error if nuxt/config.js does not exists in buildDir (#7332)
This commit is contained in:
parent
917adc0618
commit
29ebccaa65
@ -73,7 +73,7 @@ export default class Generator {
|
||||
)
|
||||
}
|
||||
const config = this.getBuildConfig()
|
||||
if (config.target !== TARGETS.static) {
|
||||
if (!config || config.target !== TARGETS.static) {
|
||||
throw new Error(
|
||||
`In order to use \`nuxt export\`, you need to run \`nuxt build --target static\``
|
||||
)
|
||||
@ -128,7 +128,11 @@ export default class Generator {
|
||||
}
|
||||
|
||||
getBuildConfig () {
|
||||
try {
|
||||
return require(path.join(this.options.buildDir, 'nuxt/config.json'))
|
||||
} catch (err) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
getAppRoutes () {
|
||||
|
Loading…
Reference in New Issue
Block a user