Fix Windows ESM import by using file URL
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user