]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
fix: use fileURLToPath instead of pathname
authorHaoqun Jiang <haoqunjiang@gmail.com>
Wed, 2 Apr 2025 06:42:36 +0000 (14:42 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Wed, 2 Apr 2025 06:42:36 +0000 (14:42 +0800)
index.ts

index 0d7e1dfba245e0586d7a5f65f17a2c25770de35d..e2340627361e226e88c37f0df133e3aac970c3d4 100755 (executable)
--- 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)