From f0ae85cd7705015610bc0b9357b0da4f1f3b384e Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Wed, 29 Apr 2020 12:36:20 +0800 Subject: [PATCH] feat(automator): add json config --- packages/uni-automator/dist/automator.json | 0 .../vue-cli-plugin-uni/lib/configure-webpack.js | 14 ++++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 packages/uni-automator/dist/automator.json diff --git a/packages/uni-automator/dist/automator.json b/packages/uni-automator/dist/automator.json new file mode 100644 index 000000000..e69de29bb diff --git a/packages/vue-cli-plugin-uni/lib/configure-webpack.js b/packages/vue-cli-plugin-uni/lib/configure-webpack.js index 941b50423..fbd5eb0db 100644 --- a/packages/vue-cli-plugin-uni/lib/configure-webpack.js +++ b/packages/vue-cli-plugin-uni/lib/configure-webpack.js @@ -198,6 +198,20 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt plugins.push(new CopyWebpackPlugin(getCopyWebpackPluginOptions(manifestPlatformOptions, vueOptions))) } + plugins.push(new CopyWebpackPlugin([{ + from: require.resolve('@dcloudio/uni-automator/dist/automator.json'), + 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({ + wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT + }) + } + return '' + } + }])) + if (process.UNI_SCRIPT_ENV && Object.keys(process.UNI_SCRIPT_ENV).length) { // custom define const envs = Object.create(null) -- GitLab