Skip to content

Commit 41a0e62

Browse files
committed
feat(config): detect vue.config.js call error (#38)
1 parent f7097c2 commit 41a0e62

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

config/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ let vueConfig: VueCliOptions = {}
1919
try {
2020
vueConfig = require(resolve(process.env.CLI_CONFIG_FILE || 'vue.config.js')) || {}
2121
} catch (e) {
22-
if (process.env.VITE_DEBUG) {
23-
console.error(chalk.redBright(e))
22+
// handle no vue.config.js
23+
if (e.code === 'MODULE_NOT_FOUND') {
24+
if (process.env.VITE_DEBUG) {
25+
console.error(chalk.redBright(e))
26+
}
27+
} else {
28+
console.error(chalk.redBright(e.stack ?? e))
2429
}
2530
}
2631

0 commit comments

Comments
 (0)