cli: use file URL for esm loader

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-26 14:35:40 +02:00
parent 7accd01a2c
commit 68158034e8
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Fix for the new backend `start` command to make it work on Windows.
@@ -21,7 +21,7 @@ import type { ChildProcess } from 'child_process';
import { IpcServer } from './IpcServer';
import { ServerDataStore } from './ServerDataStore';
import debounce from 'lodash/debounce';
import { fileURLToPath } from 'url';
import { fileURLToPath, pathToFileURL } from 'url';
import { isAbsolute as isAbsolutePath } from 'path';
import { paths } from '../paths';
import spawn from 'cross-spawn';
@@ -30,7 +30,7 @@ const loaderArgs = [
'--require',
require.resolve('@esbuild-kit/cjs-loader'),
'--loader',
require.resolve('@esbuild-kit/esm-loader'),
pathToFileURL(require.resolve('@esbuild-kit/esm-loader')).toString(), // Windows prefers a URL here
];
export async function startBackendExperimental(options: BackendServeOptions) {