Skip to content

Commit f8a801a

Browse files
fix: vite's resolver intercepting npm: specifiers
1 parent c97e822 commit f8a801a

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

packages/plugin-vite/src/plugins/deno.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export function deno(): Plugin {
2424
return true;
2525
},
2626
async resolveId(id, importer, options) {
27+
// Workaround until upstream PR is merged and released,
28+
// see: https://github.com/vitejs/vite/pull/20558
29+
if (id.startsWith("deno-npm:")) {
30+
id = id.slice("deno-".length);
31+
}
32+
2733
importer = isDenoSpecifier(importer)
2834
? parseDenoSpecifier(importer).specifier
2935
: importer;

packages/plugin-vite/src/plugins/patches.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ export function patches(): Plugin {
99
applyToEnvironment() {
1010
return true;
1111
},
12-
resolveId(id) {
13-
if (id.startsWith("deno-npm:")) {
14-
return id.slice("deno-".length);
15-
}
16-
},
1712
transform(code, id) {
1813
const res = babel.transformSync(code, {
1914
filename: id,

0 commit comments

Comments
 (0)