Merge pull request #19 from SenaxxZz/patch-1

Fix Windows ESM import by using file URL
This commit is contained in:
Kevin Codex
2026-04-01 20:24:13 +08:00
committed by GitHub

View File

@@ -9,14 +9,13 @@
import { existsSync } from 'fs'
import { join, dirname } from 'path'
import { fileURLToPath } from 'url'
import { getDistImportSpecifier } from './import-specifier.mjs'
import { fileURLToPath, pathToFileURL } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url))
const distPath = join(__dirname, '..', 'dist', 'cli.mjs')
if (existsSync(distPath)) {
await import(getDistImportSpecifier(__dirname))
await import(pathToFileURL(distPath).href)
} else {
console.error(`
openclaude: dist/cli.mjs not found.