File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,15 @@ function _tryModuleResolve(
3737 }
3838}
3939
40- function _resolve ( id : string , options : ResolveOptions = { } ) : string {
40+ 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+
4149 // Skip if already has a protocol
4250 if ( / ( n o d e | d a t a | h t t p | h t t p s ) : / . test ( id ) ) {
4351 return id ;
@@ -49,7 +57,7 @@ function _resolve(id: string, options: ResolveOptions = {}): string {
4957 }
5058
5159 // Enable fast path for file urls
52- if ( id . startsWith ( "file:" ) ) {
60+ if ( id . startsWith ( "file:// " ) ) {
5361 id = fileURLToPath ( id ) ;
5462 }
5563
You can’t perform that action at this time.
0 commit comments