From 2dba8c9455f73090b75ff1b8be4ebb530f77c4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 13 Dec 2019 10:13:17 +0800 Subject: [PATCH] fix(cli): build site failed --- packages/vant-cli/src/compiler/vant-cli-site-plugin.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/vant-cli/src/compiler/vant-cli-site-plugin.ts b/packages/vant-cli/src/compiler/vant-cli-site-plugin.ts index b32778a8c..4545ec280 100644 --- a/packages/vant-cli/src/compiler/vant-cli-site-plugin.ts +++ b/packages/vant-cli/src/compiler/vant-cli-site-plugin.ts @@ -12,7 +12,11 @@ const PLUGIN_NAME = 'VantCliSitePlugin'; export class VantCliSitePlugin { apply(compiler: Compiler) { - compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, this.genSiteEntry); + if (process.env.NODE_ENV === 'production') { + compiler.hooks.beforeCompile.tapPromise(PLUGIN_NAME, this.genSiteEntry); + } else { + compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, this.genSiteEntry); + } } genSiteEntry() {