fix: wrap this.resolve with try/catch

This commit is contained in:
Nate Moore 2021-12-14 13:10:41 -06:00
parent 95229a4d0b
commit 693cd41a1c

View file

@ -81,8 +81,10 @@ export default function configAliasVitePlugin(astroConfig: { projectRoot?: URL;
name: '@astrojs/vite-plugin-config-alias', name: '@astrojs/vite-plugin-config-alias',
enforce: 'pre', enforce: 'pre',
async resolveId(sourceId: string, importer, options) { async resolveId(sourceId: string, importer, options) {
try {
/** Resolved ID conditionally handled by any other resolver. (this gives priority to all other resolvers) */ /** Resolved ID conditionally handled by any other resolver. (this gives priority to all other resolvers) */
const resolvedId = await this.resolve(sourceId, importer, { skipSelf: true, ...options }); const resolvedId = await this.resolve(sourceId, importer, { skipSelf: true, ...options });
} catch (e) {}
// if any other resolver handles the file, return that resolution // if any other resolver handles the file, return that resolution
if (resolvedId) return resolvedId; if (resolvedId) return resolvedId;