From 20f25bfe1c98298415dc35738373f9d5bfb41d98 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Wed, 10 May 2023 10:22:28 -0400 Subject: [PATCH] fix(js): use valid file paths on Windows when executing program (#16911) --- packages/js/src/executors/node/node-with-require-overrides.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/js/src/executors/node/node-with-require-overrides.ts b/packages/js/src/executors/node/node-with-require-overrides.ts index f8583422c609f..b860c5ba6a1f6 100644 --- a/packages/js/src/executors/node/node-with-require-overrides.ts +++ b/packages/js/src/executors/node/node-with-require-overrides.ts @@ -1,11 +1,12 @@ const Module = require('module'); +const url = require('url'); const originalLoader = Module._load; const dynamicImport = new Function('specifier', 'return import(specifier)'); const mappings = JSON.parse(process.env.NX_MAPPINGS); const keys = Object.keys(mappings); -const fileToRun = process.env.NX_FILE_TO_RUN; +const fileToRun = url.pathToFileURL(process.env.NX_FILE_TO_RUN); Module._load = function (request, parent) { if (!parent) return originalLoader.apply(this, arguments);