From b4e600b50c4cf5d2188691287952e4a7c69430d3 Mon Sep 17 00:00:00 2001 From: Gcaufy Date: Thu, 6 Jun 2019 21:28:30 +0800 Subject: [PATCH] fix(cli): fixed compile sequence --- packages/cli/core/plugins/parser/wpy.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/cli/core/plugins/parser/wpy.js b/packages/cli/core/plugins/parser/wpy.js index bab4ea339..40f9fe8e6 100644 --- a/packages/cli/core/plugins/parser/wpy.js +++ b/packages/cli/core/plugins/parser/wpy.js @@ -34,7 +34,11 @@ exports = module.exports = function () { context.useCache = true; sfc = context.sfc; - flow = Promise.resolve(true); + if (context.done) { + flow = Promise.resolve(true); // For file watch, still need to go throught all the dependences + } else { + flow = context.promise; + } } else { this.compiled[file] = context; context.useCache = false; @@ -66,7 +70,7 @@ exports = module.exports = function () { this.involved[file] = 1; - return flow.then(() => { + context.promise = flow.then(() => { return this.applyCompiler(context.sfc.config, context); }).then(() => { if (sfc.wxs) { @@ -93,8 +97,11 @@ exports = module.exports = function () { })); } }).then((all = []) => { + context.done = true; return context; }); + + return context.promise; });