Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

absolute paths to workers in windows not working when containing a drive letter #15

Open
MartyHav opened this issue May 2, 2021 · 1 comment

Comments

@MartyHav
Copy link

MartyHav commented May 2, 2021

When we create a base url here:

const baseUrl = URL.pathToFileURL(process.cwd() + '/');

It will be ignored later here, if the given url contains drive letter ( like "c:/foo/bar") :

web-worker/node.js

Lines 100 to 102 in 4a46d3a

else {
mod = URL.fileURLToPath(new URL.URL(url, baseUrl));
}

And fileURLToPath will throw an error ( "URL not a file scheme" ) as the drive letter is set as protocol and file scheme of baseUrl is ignored.

I think we are safe when we do it like this:

const urlObject = new URL.URL(url, baseUrl);
mod = urlObject.pathName;

Not sure if this is bypassing the reason why fileUrlToPath is used at all.
But did work for me on Windows and macOS.

@Silic0nS0ldier
Copy link

I've developed a fix for this and aim to have a PR up soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants