Skip to content
Snippets Groups Projects
Unverified Commit ed03c40d authored by Ilya Kirov's avatar Ilya Kirov Committed by GitHub
Browse files

fix: Fix import error on Windows (ERR_UNSUPPORTED_ESM_URL_SCHEME) (#27519)

parent 02b08834
Branches
No related tags found
No related merge requests found
......@@ -218,7 +218,8 @@ export default abstract class ExternalJSExtension<M> extends Extension {
fs.copyFileSync(file, tmpFile);
try {
// Do `replaceAll("\\", "/")` to prevent issues on Windows
const mod = await import(tmpFile.replaceAll("\\", "/"));
/* v8 ignore next */
const mod = await import(os.platform() === "win32" ? `file:///${tmpFile.replaceAll("\\", "/")}` : tmpFile);
return mod;
} finally {
fs.rmSync(tmpFile);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment