Skip to content

improve find project config file error handler

Compare
Choose a tag to compare
@IndexXuan IndexXuan released this 11 Sep 02:19
· 16 commits to main since this release

this plugin will require vue.config.js for extra vite plugins merge. this release improve the error report of it.
something like TypeError/ReferenceError but slient when project don't have vue.config.js.

let vueConfig = {}
try {
  vueConfig = require(resolve(process.env.CLI_CONFIG_FILE || 'vue.config.js')) || {}
} catch (e) {
  // handle no vue.config.js
  if (e.code === 'MODULE_NOT_FOUND') {
    if (process.env.VITE_DEBUG) {
      console.error(chalk.redBright(e))
    }
  } else {
    console.error(chalk.redBright(e.stack ?? e))
  }
}

close: #38