From 70cc437d71eccb5c3d715ead1523ad92253f3f6e Mon Sep 17 00:00:00 2001 From: David Nanyan <41910751+DaveFres@users.noreply.github.com> Date: Thu, 1 May 2025 14:42:35 -0700 Subject: [PATCH] [ISSUE-3145] Fix Windows path issue: Correct handling of import.meta.url to avoid leading slash in pathname (#3237) * [ISSUE-3145] Fix Windows path issue: Correct handling of import.meta.url to avoid leading slash in pathname * Add changeset file --- .changeset/tall-cups-fly.md | 5 +++++ proto/build-proto.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/tall-cups-fly.md diff --git a/.changeset/tall-cups-fly.md b/.changeset/tall-cups-fly.md new file mode 100644 index 00000000..ae15926b --- /dev/null +++ b/.changeset/tall-cups-fly.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +Fix Windows path issue: Correct handling of import.meta.url to avoid leading slash in pathname diff --git a/proto/build-proto.js b/proto/build-proto.js index 4e07d1ae..dc3e55ea 100755 --- a/proto/build-proto.js +++ b/proto/build-proto.js @@ -2,6 +2,7 @@ import * as fs from "fs/promises" import * as path from "path" +import { fileURLToPath } from "url" import { execSync } from "child_process" import { globby } from "globby" import chalk from "chalk" @@ -12,7 +13,8 @@ const protoc = path.join(require.resolve("grpc-tools"), "../bin/protoc") const tsProtoPlugin = require.resolve("ts-proto/protoc-gen-ts_proto") // Get script directory and root directory -const SCRIPT_DIR = path.dirname(new URL(import.meta.url).pathname) +const __filename = fileURLToPath(import.meta.url) +const SCRIPT_DIR = path.dirname(__filename) const ROOT_DIR = path.resolve(SCRIPT_DIR, "..") async function main() {