From ce41994ee4e395bb304191b5d9a26f0f32d3b47a Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 12 May 2020 15:15:16 -0400 Subject: [PATCH] fix: fix web modules resolve --- src/node/server/serverPluginModuleRewrite.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node/server/serverPluginModuleRewrite.ts b/src/node/server/serverPluginModuleRewrite.ts index 322928da579f3a..639e7acc48cb95 100644 --- a/src/node/server/serverPluginModuleRewrite.ts +++ b/src/node/server/serverPluginModuleRewrite.ts @@ -286,8 +286,9 @@ export const resolveImport = ( if (bareImportRE.test(id)) { // directly resolve bare module names to its entry path so that relative // imports from it (including source map urls) can work correctly + const isWebModule = !!resolveWebModule(root, id) return `/@modules/${ - resolveWebModule(root, id) || resolveNodeModuleEntry(root, id) || id + isWebModule ? id : resolveNodeModuleEntry(root, id) || id }` } else { let { pathname, query } = resolveRelativeRequest(importer, id)