From 63795235ff79c3c6cf039b01f9cb388377ea1dd3 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Sun, 31 Jan 2021 00:42:05 +0800 Subject: [PATCH] chore(cli): ignore automator when subpackage --- .../lib/configure-webpack.js | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/vue-cli-plugin-uni/lib/configure-webpack.js b/packages/vue-cli-plugin-uni/lib/configure-webpack.js index ddab51ec5..101cccc09 100644 --- a/packages/vue-cli-plugin-uni/lib/configure-webpack.js +++ b/packages/vue-cli-plugin-uni/lib/configure-webpack.js @@ -197,24 +197,25 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt if (!isAppView) { // app-plus view不需要copy plugins.push(new CopyWebpackPlugin(getCopyWebpackPluginOptions(manifestPlatformOptions, vueOptions))) } - - try { - const automatorJson = require.resolve('@dcloudio/uni-automator/dist/automator.json') - plugins.push(new CopyWebpackPlugin([{ - from: automatorJson, - to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) + - '/.automator.json', - transform (content) { - if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) { - return JSON.stringify({ - version: require('@dcloudio/uni-automator/package.json').version, - wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT - }) + if (!process.env.UNI_SUBPACKGE) { + try { + const automatorJson = require.resolve('@dcloudio/uni-automator/dist/automator.json') + plugins.push(new CopyWebpackPlugin([{ + from: automatorJson, + to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) + + '/.automator.json', + transform (content) { + if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) { + return JSON.stringify({ + version: require('@dcloudio/uni-automator/package.json').version, + wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT + }) + } + return '' } - return '' - } - }])) - } catch (e) {} + }])) + } catch (e) {} + } if (process.UNI_SCRIPT_ENV && Object.keys(process.UNI_SCRIPT_ENV).length) { // custom define -- GitLab