From 64382337ed7626c2ec510644feb305170345ef6b Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 18 May 2022 13:23:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BA=AF=20nvue=20=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20uni=5Fmodules=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=8B=B7=E8=B4=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../build/webpack.nvue.conf.js | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js b/packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js index 709da3ec9..4cfb6271c 100644 --- a/packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js +++ b/packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js @@ -211,9 +211,11 @@ if (process.env.UNI_USING_V3_NATIVE) { if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { plugins.push(new WebpackUniMPPlugin()) + const assetsDir = 'static' + const hybridDir = 'hybrid/html' const array = [{ - from: path.resolve(process.env.UNI_INPUT_DIR, 'static'), - to: 'static' + from: path.resolve(process.env.UNI_INPUT_DIR, assetsDir), + to: assetsDir }] // 自动化测试时,不启用androidPrivacy.json if (!process.env.UNI_AUTOMATOR_WS_ENDPOINT) { @@ -225,14 +227,27 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { }) } } - const hybridHtmlPath = path.resolve(process.env.UNI_INPUT_DIR, 'hybrid/html') + const hybridHtmlPath = path.resolve(process.env.UNI_INPUT_DIR, hybridDir) if (fs.existsSync(hybridHtmlPath)) { array.push({ from: hybridHtmlPath, - to: 'hybrid/html' + to: hybridDir }) } + global.uniModules.forEach(module => { + const modules = 'uni_modules/' + const assets = modules + module + '/' + assetsDir + const hybrid = modules + module + hybridDir + array.push({ + from: path.resolve(process.env.UNI_INPUT_DIR, assets), + to: assets + }, { + from: path.resolve(process.env.UNI_INPUT_DIR, hybrid), + to: hybrid + }) + }) + if (process.env.UNI_USING_NVUE_COMPILER) { array.push({ from: path.resolve(getTemplatePath(), 'common'), -- GitLab