From f2cb2b2b50f7f0ad8dcb16ee2a11a912053ff0b6 Mon Sep 17 00:00:00 2001 From: panzhenyu1 Date: Fri, 22 Jul 2022 11:26:43 +0800 Subject: [PATCH] Swtich js-engine of previewer to quickJS related issue: https://gitee.com/openharmony/arkui_ace_engine/issues/I5IE08 Signed-off-by: panzhenyu1 Change-Id: I84260985261e98794485b55c839401404ea37294 --- ace-loader/src/compile-plugin.js | 35 +------------------------------ ace-loader/webpack.rich.config.js | 12 ++++++----- 2 files changed, 8 insertions(+), 39 deletions(-) diff --git a/ace-loader/src/compile-plugin.js b/ace-loader/src/compile-plugin.js index 4ba79c8..aee446b 100644 --- a/ace-loader/src/compile-plugin.js +++ b/ace-loader/src/compile-plugin.js @@ -217,42 +217,9 @@ function printResult(buildPath) { if (noteCount > 0) { resultInfo.NOTE = noteCount; } - if (result === 'SUCCESS ' && process.env.isPreview) { - printPreviewResult(resultInfo); - } else { - console.log(blue, 'COMPILE RESULT:' + result + JSON.stringify(resultInfo), reset); - } + console.log(blue, 'COMPILE RESULT:' + result + JSON.stringify(resultInfo), reset); } else { - if (process.env.isPreview) { - printPreviewResult(); - } else { - console.log(blue, 'COMPILE RESULT:SUCCESS ', reset); - } - } -} - -function printPreviewResult(resultInfo = "") { - let workerNum = Object.keys(cluster.workers).length; - let count_ = 0; - if (workerNum > 0) { - for (const worker of Object.values(cluster.workers)) { - worker.on('exit', function(code, signal) { - count_++; - if (count_ === workerNum) { - printSuccessInfo(resultInfo); - } - }); - } - } else { - printSuccessInfo(resultInfo); - } -} - -function printSuccessInfo(resultInfo) { - if (resultInfo.length === 0) { console.log(blue, 'COMPILE RESULT:SUCCESS ', reset); - } else { - console.log(blue, 'COMPILE RESULT:SUCCESS ' + JSON.stringify(resultInfo), reset); } } diff --git a/ace-loader/webpack.rich.config.js b/ace-loader/webpack.rich.config.js index 2ec9c33..80bdd73 100644 --- a/ace-loader/webpack.rich.config.js +++ b/ace-loader/webpack.rich.config.js @@ -203,7 +203,7 @@ function setConfigs(env) { function setArkPlugin(env, workerFile) { config.plugins.push(new ModuleCollectionPlugin()) - if (env.isPreview === "true" || env.compilerType && env.compilerType === 'ark') { + if (env.compilerType && env.compilerType === 'ark') { let arkDir = path.join(__dirname, 'bin', 'ark'); if (env.arkFrontendDir) { arkDir = env.arkFrontendDir; @@ -212,8 +212,6 @@ function setArkPlugin(env, workerFile) { if (env.nodeJs) { nodeJs = env.nodeJs; } - config.plugins.push(new GenAbcPlugin(process.env.buildPath, arkDir, nodeJs, workerFile, - env.buildMode === 'debug')) if (env.buildMode === 'release' && process.env.DEVICE_LEVEL !== 'card') { config.output.path = path.join(process.env.cachePath, "releaseAssets", path.basename(process.env.buildPath)); @@ -310,7 +308,9 @@ module.exports = (env) => { if (process.env.DEVICE_LEVEL === 'card') { config.module = cardModule config.plugins.push(new AfterEmitPlugin()) - setArkPlugin(env, workerFile); + if (env.isPreview !== "true") { + setArkPlugin(env, workerFile); + } } else { if (process.env.compileMode !== 'moduleJson' && process.env.abilityType === 'page') { config.optimization = { @@ -336,7 +336,9 @@ module.exports = (env) => { }, } } - setArkPlugin(env, workerFile); + if (env.isPreview !== "true") { + setArkPlugin(env, workerFile); + } if (env.sourceMap === 'none') { config.devtool = false }