From 8e97e861f2d75681db8edec458ded4518b68184b Mon Sep 17 00:00:00 2001 From: Costin Sin Date: Tue, 2 Jul 2024 17:06:48 +0300 Subject: [PATCH 1/2] [windows] Specify the `file://` protocol when importing config on Windows On Windows, if the file protocol is not specified when using dynamic imports, the process exits with ERR_UNSUPPORTED_ESM_URL_SCHEME error. Signed-off-by: Costin Sin --- packages/open-next/src/build.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/open-next/src/build.ts b/packages/open-next/src/build.ts index 42f9497fd..201a6c160 100755 --- a/packages/open-next/src/build.ts +++ b/packages/open-next/src/build.ts @@ -50,11 +50,13 @@ export async function build( // Load open-next.config.ts const tempDir = initTempDir(); - const configPath = compileOpenNextConfigNode( + let configPath = compileOpenNextConfigNode( tempDir, openNextConfigPath, nodeExternals, ); + // On Windows, we need to use file:// protocol to load the config file using import() + if (process.platform === "win32") configPath = `file://${configPath}`; config = (await import(configPath)).default as OpenNextConfig; validateConfig(config); From 894631adc303616a979477db5bd56556c8820e74 Mon Sep 17 00:00:00 2001 From: conico974 Date: Mon, 8 Jul 2024 19:25:53 +0200 Subject: [PATCH 2/2] Create witty-dots-film.md --- .changeset/witty-dots-film.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/witty-dots-film.md diff --git a/.changeset/witty-dots-film.md b/.changeset/witty-dots-film.md new file mode 100644 index 000000000..ec3abb32a --- /dev/null +++ b/.changeset/witty-dots-film.md @@ -0,0 +1,5 @@ +--- +"open-next": patch +--- + +[windows] Specify the `file://` protocol when importing config on Windows