File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ where
185185
186186 fn visit_import_declaration ( & mut self , it : & ImportDeclaration < ' data > ) {
187187 let str = it. source . to_string ( ) ;
188- if str. contains ( ":" ) || str. starts_with ( "/" ) || str. starts_with ( "./ " ) || str. starts_with ( "../ " ) {
188+ if str. contains ( ":" ) || str. starts_with ( "/" ) || str. starts_with ( "." ) || str. starts_with ( ".." ) {
189189 self . rewrite_url ( & it. source , true ) ;
190190 }
191191 walk:: walk_import_declaration ( self , it) ;
Original file line number Diff line number Diff line change @@ -8,9 +8,20 @@ export default function (client: ScramjetClient, self: Self) {
88 self [ config . globals . importfn ] = function ( base : string , url : string ) {
99 const resolved = new URL ( url , base ) . href ;
1010
11- return Function (
12- `return import("${ rewriteUrl ( resolved , client . meta ) } ?type=module")`
13- ) ( ) ;
11+ if (
12+ url . includes ( ":" ) ||
13+ url . startsWith ( "/" ) ||
14+ url . startsWith ( "." ) ||
15+ url . startsWith ( ".." )
16+ ) {
17+ // this is a url
18+ return Function (
19+ `return import("${ rewriteUrl ( resolved , client . meta ) } ?type=module")`
20+ ) ( ) ;
21+ } else {
22+ // this is a specifier handled by importmaps
23+ return Function ( `return import("${ url } ")` ) ( ) ;
24+ }
1425 } ;
1526
1627 self [ config . globals . metafn ] = function ( base : string ) {
You can’t perform that action at this time.
0 commit comments