Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix buildUrl relative path support (playcanvas#6354)
buildUrl never worked with relative paths as it would always replace the path in the url instead of adding to it. Using the other mode of the URL constructor we can use it to always give us a correct url: `new URL('glslang/glslang.js', 'https://example.com/foo/bar.html')` is `https://example.com/foo/glslang/glslang.js` `new URL('/glslang/glslang.js', 'https://example.com/foo/bar.html')` is `https://example.com/glslang/glslang.js` `new URL('glslang/glslang.js', 'https://example.com/')` is `https://example.com/glslang/glslang.js` `new URL('/glslang/glslang.js', 'https://example.com/')` is `https://example.com/glslang/glslang.js` This bug currently prevents Playcanvas Editor exports from being run on a non root path with WebGPU. It will just pass `glslang.js` as path. So on a url like https://94176748-9ef8-42c9-a44e-a95b70ec5680.poki-gdn.com/7a8f1fc6-7162-473a-b1dc-4479ed5d60cf/ the old code would turn it into https://94176748-9ef8-42c9-a44e-a95b70ec5680.poki-gdn.com/glslang.js whil the actual paths should be https://94176748-9ef8-42c9-a44e-a95b70ec5680.poki-gdn.com/7a8f1fc6-7162-473a-b1dc-4479ed5d60cf/glslang.js
- Loading branch information