We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48acc8d commit 778bd73Copy full SHA for 778bd73
src/resolve.ts
@@ -37,7 +37,15 @@ function _tryModuleResolve(
37
}
38
39
40
-function _resolve(id: string, options: ResolveOptions = {}): string {
+function _resolve(id: string | URL, options: ResolveOptions = {}): string {
41
+ if (typeof id !== "string") {
42
+ if (id instanceof URL) {
43
+ id = fileURLToPath(id);
44
+ } else {
45
+ throw new TypeError("input must be a `string` or `URL`");
46
+ }
47
48
+
49
// Skip if already has a protocol
50
if (/(node|data|http|https):/.test(id)) {
51
return id;
@@ -49,7 +57,7 @@ function _resolve(id: string, options: ResolveOptions = {}): string {
57
58
59
// Enable fast path for file urls
52
- if (id.startsWith("file:")) {
60
+ if (id.startsWith("file://")) {
53
61
id = fileURLToPath(id);
54
62
55
63
0 commit comments