fix: wrap loadConfig in try/catch

This commit is contained in:
Nate Moore 2021-12-14 15:30:49 -06:00
parent 9388fd0cdf
commit 4c21b35ea6

View file

@ -132,7 +132,10 @@ export async function loadConfig(options: LoadConfigOptions): Promise<AstroConfi
}
// Automatically load config file using Proload
// If `userConfigPath` is `undefined`, Proload will search for `astro.config.[cm]?[jt]s`
const config = await load('astro', { mustExist: false, cwd: root, filePath: userConfigPath });
let config;
try {
config = await load('astro', { mustExist: false, cwd: root, filePath: userConfigPath });
} catch (e) {}
if (config) {
userConfig = config.value;
}