From: Haoqun Jiang Date: Wed, 2 Apr 2025 06:42:36 +0000 (+0800) Subject: fix: use fileURLToPath instead of pathname X-Git-Tag: v3.16.2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=424eb658a94b998e652ddcfd3cd72b9bfe718e7a;p=thirdparty%2Fvuejs%2Fcreate-vue.git fix: use fileURLToPath instead of pathname --- diff --git a/index.ts b/index.ts index 0d7e1dfb..e2340627 100755 --- a/index.ts +++ b/index.ts @@ -2,7 +2,7 @@ import * as fs from 'node:fs' import * as path from 'node:path' - +import { fileURLToPath } from 'node:url' import { parseArgs } from 'node:util' import { intro, outro, text, confirm, multiselect, select, isCancel, cancel } from '@clack/prompts' import { red, green, cyan, bold, dim } from 'picocolors' @@ -368,7 +368,7 @@ async function init() { const pkg = { name: result.packageName, version: '0.0.0' } fs.writeFileSync(path.resolve(root, 'package.json'), JSON.stringify(pkg, null, 2)) - const templateRoot = new URL('./template', import.meta.url).pathname + const templateRoot = fileURLToPath(new URL('./template', import.meta.url)) const callbacks = [] const render = function render(templateName) { const templateDir = path.resolve(templateRoot, templateName)