fix: __dirname on windows
bruh i hate windows
This commit is contained in:
parent
5e3b6aa626
commit
10ccfae496
2 changed files with 5 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
import * as colors from 'colorette'
|
||||
import { join } from 'node:path'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
import { askForConfig } from './cli.js'
|
||||
import { installDependencies } from './dependencies.js'
|
||||
|
@ -18,7 +19,7 @@ const config = await askForConfig()
|
|||
config.name = projectName
|
||||
const outDir = process.env.TARGET_DIR || join(process.cwd(), projectName)
|
||||
|
||||
const __dirname = new URL('.', import.meta.url).pathname
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
await runTemplater(join(__dirname, '../template'), outDir, config)
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ import { join } from 'path'
|
|||
import { InitInput } from './types.js'
|
||||
|
||||
// @only-if-esm
|
||||
const __dirname = new URL('.', import.meta.url).pathname
|
||||
const url = await import('url')
|
||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
||||
// @/only-if-esm
|
||||
|
||||
export async function loadWasmBinary(input?: InitInput): Promise<WebAssembly.Instance> {
|
||||
|
|
Loading…
Reference in a new issue