Skip to content

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