From d4eefcf887bbda3f10f0f95d7b4bb1f173fd2997 Mon Sep 17 00:00:00 2001 From: YaoXiangMei <756006942@qq.com> Date: Fri, 22 Jan 2021 17:13:39 +0800 Subject: [PATCH] fix(create-vant-cli-app): window system failed to generate template (#7904) (#7958) --- packages/create-vant-cli-app/src/generator.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/create-vant-cli-app/src/generator.ts b/packages/create-vant-cli-app/src/generator.ts index 3052998cd..e28087d35 100644 --- a/packages/create-vant-cli-app/src/generator.ts +++ b/packages/create-vant-cli-app/src/generator.ts @@ -62,9 +62,11 @@ export class VanGenerator extends Generator { writing() { consola.info(`Creating project in ${join(CWD, this.inputs.name)}\n`); - - const templatePath = join(GENERATOR_DIR, this.inputs.vueVersion); - const templateFiles = glob.sync(join(templatePath, '**', '*'), { + /** + @see {@link https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows} + */ + const templatePath = join(GENERATOR_DIR, this.inputs.vueVersion).replace(/\\/g, '/'); + const templateFiles = glob.sync(join(templatePath, '**', '*').replace(/\\/g, '/'), { dot: true, }); const destinationRoot = this.destinationRoot();