From 5d06c773ffb0057e6b0d2bb56d9221247a6b38eb Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Sat, 16 Sep 2023 09:54:49 +0800 Subject: [PATCH] f --- src/middleware/global_options.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/middleware/global_options.ts b/src/middleware/global_options.ts index aa41e34..ed6259a 100644 --- a/src/middleware/global_options.ts +++ b/src/middleware/global_options.ts @@ -1,5 +1,6 @@ import { debuglog } from 'node:util'; import path from 'node:path'; +import { pathToFileURL } from 'node:url'; import { Inject, ApplicationLifecycle, LifecycleHook, LifecycleHookUnit, Program, CommandContext, @@ -108,7 +109,8 @@ export default class implements ApplicationLifecycle { if (process.platform === 'win32') { // ES Module loading with abolute path fails on windows // https://github.com/nodejs/node/issues/31710#issuecomment-583916239 - esmLoader = `file://${esmLoader}`; + // https://nodejs.org/api/url.html#url_url_pathtofileurl_path + esmLoader = pathToFileURL(esmLoader).href; } addNodeOptionsToEnv(`--loader ${esmLoader}`, ctx.env); }