Skip to content

Commit 77a7597

Browse files
authored
fix: ignore protocol when resolve svelte field (#225)
1 parent 4021352 commit 77a7597

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/clean-rice-fly.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte': patch
3+
---
4+
5+
Ignore import protocols like `node:` when resolving the `svelte` field in package.json

packages/vite-plugin-svelte/src/utils/resolve.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ export function resolveViaPackageJsonSvelte(importee: string, importer?: string)
1414
}
1515

1616
function isBareImport(importee: string): boolean {
17-
if (!importee || importee[0] === '.' || importee[0] === '\0' || path.isAbsolute(importee)) {
17+
if (
18+
!importee ||
19+
importee[0] === '.' ||
20+
importee[0] === '\0' ||
21+
importee.includes(':') ||
22+
path.isAbsolute(importee)
23+
) {
1824
return false;
1925
}
2026
const parts = importee.split('/');

0 commit comments

Comments
 (0)