From c4489ea193f4d2f703882cb03490980aa5174040 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Thu, 13 Oct 2022 15:37:09 +0800 Subject: [PATCH] fix(config): partial deno support (#10446) --- packages/vite/src/node/config.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index dd0feee665ae34..9467cad2c1f7df 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -986,6 +986,10 @@ async function bundleConfigFile( build.onResolve({ filter: /.*/ }, ({ path: id, importer, kind }) => { // externalize bare imports if (id[0] !== '.' && !path.isAbsolute(id) && !isBuiltin(id)) { + // partial deno support as `npm:` does not work in `tryNodeResolve` + if (id.startsWith('npm:')) { + return { external: true } + } let idFsPath = tryNodeResolve(id, importer, options, false)?.id if (idFsPath && (isESM || kind === 'dynamic-import')) { idFsPath = pathToFileURL(idFsPath).href