File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,11 @@ export const parse = (u: string | URL) => new URL(u);
26
26
* @returns
27
27
*/
28
28
export function resolve ( from : string , to : string ) {
29
- const fromUrl = new URL ( convertPathToPosix ( from ) , "resolve://" ) ;
29
+ // we use a non-existent URL to check if its a relative URL
30
+ const fromUrl = new URL ( convertPathToPosix ( from ) , "https://aaa.nonexistanturl.com" ) ;
30
31
const resolvedUrl = new URL ( convertPathToPosix ( to ) , fromUrl ) ;
31
32
const endSpaces = to . match ( / ( \s * ) $ / ) ?. [ 1 ] || "" ;
32
- if ( resolvedUrl . protocol === "resolve: " ) {
33
+ if ( resolvedUrl . hostname === "aaa.nonexistanturl.com " ) {
33
34
// `from` is a relative URL.
34
35
const { pathname, search, hash } = resolvedUrl ;
35
36
return pathname + search + hash + endSpaces ;
You can’t perform that action at this time.
0 commit comments