From b8a0184b64a7a7bdaf4f33205cf392ffa55854ad Mon Sep 17 00:00:00 2001 From: "zc.zhang" Date: Wed, 12 Jul 2023 12:52:46 +0800 Subject: [PATCH] fix path import on windows --- .changeset/smart-spoons-shave.md | 5 +++++ packages/dev/scripts/import.mjs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/smart-spoons-shave.md diff --git a/.changeset/smart-spoons-shave.md b/.changeset/smart-spoons-shave.md new file mode 100644 index 0000000..2a4226d --- /dev/null +++ b/.changeset/smart-spoons-shave.md @@ -0,0 +1,5 @@ +--- +"@zcloak/dev": patch +--- + +fix import path on windows diff --git a/packages/dev/scripts/import.mjs b/packages/dev/scripts/import.mjs index 607c397..25f499f 100644 --- a/packages/dev/scripts/import.mjs +++ b/packages/dev/scripts/import.mjs @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 import path from 'path'; +import { pathToFileURL } from 'url'; export function importPath(req) { - return path.join(process.cwd(), 'node_modules', req); + return pathToFileURL(path.join(process.cwd(), 'node_modules', req)).toString(); } export async function importDirect(bin, req) {