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

fix: support imports of absolute paths of ESM files on Windows #8669

Merged

Conversation

giladgd
Copy link
Contributor

@giladgd giladgd commented Feb 18, 2022

Description of change

Support importing absolute paths of ESM file on Windows.

For example, this code would work now:

import {importOrRequireFile} from "./util/ImportUtils";

await importOrRequireFile("./index.mjs");
await importOrRequireFile("./index.cjs");

// on macOS / Linux
await importOrRequireFile("/Users/user/Documents/index.mjs");
await importOrRequireFile("/Users/user/Documents/index.cjs");

// on Windows
await importOrRequireFile("C:\\Users\\user\\Documents\\index.mjs"); // this line previously thrown an error, this PR fixes that
await importOrRequireFile("C:\\Users\\user\\Documents\\index.cjs");

Closes #8651

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change - The best way to test this code would be to run tests also on a Windows machine which would catch issue like this one, but I guess this is out of scope for the issue
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@pleerock
Copy link
Member

Thanks a lot!

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.

Error: ERR_UNSUPPORTED_ESM_URL_SCHEME for new release on run
2 participants