Skip to content

Commit

Permalink
fix: dynamic import of options not possible on windows
Browse files Browse the repository at this point in the history
The file path needs to be converted to a file url.
  • Loading branch information
elyukai committed Jan 16, 2024
1 parent 2c6e91a commit 325c339
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { watch } from "node:fs/promises"
import { resolve } from "node:path"
import { argv, cwd } from "node:process"
import { pathToFileURL } from "node:url"
import { GeneratorOptions, generate } from "../main.js"

const cliOptions = argv
Expand All @@ -26,7 +27,8 @@ const optionsPath = resolve(
"otjsmd.config.js"
)

const options = (await import(optionsPath)).default as GeneratorOptions
const options = (await import(pathToFileURL(optionsPath).toString()))
.default as GeneratorOptions

if (cliOptions.has("-w") || cliOptions.has("--watch")) {
try {
Expand Down

0 comments on commit 325c339

Please sign in to comment.