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);
2626 * @returns
2727 */
2828export 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" ) ;
3031 const resolvedUrl = new URL ( convertPathToPosix ( to ) , fromUrl ) ;
3132 const endSpaces = to . match ( / ( \s * ) $ / ) ?. [ 1 ] || "" ;
32- if ( resolvedUrl . protocol === "resolve: " ) {
33+ if ( resolvedUrl . hostname === "aaa.nonexistanturl.com " ) {
3334 // `from` is a relative URL.
3435 const { pathname, search, hash } = resolvedUrl ;
3536 return pathname + search + hash + endSpaces ;
You can’t perform that action at this time.
0 commit comments