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

use pathToFileURL #6

Merged
merged 4 commits into from
May 16, 2023
Merged

use pathToFileURL #6

merged 4 commits into from
May 16, 2023

Conversation

SnowMarble
Copy link
Contributor

@SnowMarble SnowMarble commented Apr 26, 2023

After v0.0.4 update, I found a small issue while working on windows.

This is error log I got (I'm using yarn 3.5.0)

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at new NodeError (node:internal/errors:399:5)
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1059:11) 
    at defaultResolve (node:internal/modules/esm/resolve:1135:3)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at resolve$1 (file:///C:/Users/kracc/Desktop/code/dimipay/.pnp.loader.mjs:1966:14)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)        
    at ESMLoader.import (node:internal/modules/esm/loader:525:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1186:29) {    
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

The reason is that resolvedPath does not contain file:// protocol on windows - fixing with pathToFileURL

@SnowMarble SnowMarble changed the title fix: add file:// to resolvedPath for windows Add file:// to resolvedPath for windows Apr 26, 2023
@SnowMarble
Copy link
Contributor Author

@cspotcode I just let you remind in case you miss the pr 😸

@kbzowski
Copy link
Contributor

kbzowski commented May 7, 2023

@cspotcode please merge, 0.0.4 is broken on Windows or consider #7 as alternative

index.js Outdated Show resolved Hide resolved
@SnowMarble SnowMarble changed the title Add file:// to resolvedPath for windows use pathToFileURL May 7, 2023
@SnowMarble SnowMarble requested a review from cspotcode May 8, 2023 00:11
@SnowMarble
Copy link
Contributor Author

also applied pathToFileURL to absolute path

@SnowMarble
Copy link
Contributor Author

@cspotcode hope you didn't forget 🙏

@cspotcode cspotcode merged commit fe9a612 into cspotcode:main May 16, 2023
@SnowMarble SnowMarble deleted the patch-1 branch May 16, 2023 21:55
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

Successfully merging this pull request may close these issues.

3 participants