fix(nitro): improve externals error handling (#1188)

This commit is contained in:
Daniel Roe 2021-10-18 17:08:37 +01:00 committed by GitHub
parent 47c004ac97
commit 80883cfb8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,8 +52,12 @@ export function externals (opts: NodeExternalsOptions): Plugin {
// Track externals // Track externals
if (opts.trace !== false) { if (opts.trace !== false) {
const resolved = await this.resolve(originalId, importer, { ...options, skipSelf: true }).then(r => r.id) const resolved = await this.resolve(originalId, importer, { ...options, skipSelf: true })
trackedExternals.add(resolved) if (!resolved) {
console.warn(`Could not resolve \`${originalId}\`. Have you installed it?`)
} else {
trackedExternals.add(resolved.id)
}
} }
return { return {