From 9d5a16922a8e13192cb3b9ff6307414b5d479e80 Mon Sep 17 00:00:00 2001 From: qiang Date: Fri, 20 May 2022 20:33:17 +0800 Subject: [PATCH] fix: uniModules static --- .../build/webpack.nvue.conf.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 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 4cfb6271c..4ff9ae8e8 100644 --- a/packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js +++ b/packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js @@ -238,14 +238,21 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { 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 - }) + const assetsPath = path.resolve(process.env.UNI_INPUT_DIR, assets) + if (fs.existsSync(assetsPath)) { + array.push({ + from: assetsPath, + to: assets + }) + } + const hybridHtml = modules + module + '/' + hybridDir + const hybridHtmlPath = path.resolve(process.env.UNI_INPUT_DIR, hybridHtml) + if (fs.existsSync(hybridHtmlPath)) { + array.push({ + from: hybridHtmlPath, + to: hybridHtml + }) + } }) if (process.env.UNI_USING_NVUE_COMPILER) { -- GitLab