From 57cb1f7382ddf9bf1729b6e3851576e04b30a13c Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 13 Nov 2020 11:26:01 +0800 Subject: [PATCH] chore(cli): add watch ignored --- .../vue-cli-plugin-uni/lib/configure-webpack.js | 3 ++- packages/vue-cli-plugin-uni/lib/h5/index.js | 5 ++++- packages/vue-cli-plugin-uni/lib/util.js | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/vue-cli-plugin-uni/lib/configure-webpack.js b/packages/vue-cli-plugin-uni/lib/configure-webpack.js index ef2ef09077..ddab51ec53 100644 --- a/packages/vue-cli-plugin-uni/lib/configure-webpack.js +++ b/packages/vue-cli-plugin-uni/lib/configure-webpack.js @@ -314,7 +314,8 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt assetFilter (assetFilename) { return !(/\.map$/.test(assetFilename)) && !(/vendor/.test(assetFilename)) } - } + }, + watchOptions: require('./util').getWatchOptions() }, platformWebpackConfig) } } diff --git a/packages/vue-cli-plugin-uni/lib/h5/index.js b/packages/vue-cli-plugin-uni/lib/h5/index.js index cb99044201..2072a04d4f 100644 --- a/packages/vue-cli-plugin-uni/lib/h5/index.js +++ b/packages/vue-cli-plugin-uni/lib/h5/index.js @@ -154,7 +154,10 @@ module.exports = { 'vue-style-loader': resolve('packages/h5-vue-style-loader') } }, - plugins + plugins, + devServer: { + watchOptions: require('../util').getWatchOptions() + } } }, chainWebpack (webpackConfig, vueOptions, api) { diff --git a/packages/vue-cli-plugin-uni/lib/util.js b/packages/vue-cli-plugin-uni/lib/util.js index 72091b8830..56d2a15b29 100644 --- a/packages/vue-cli-plugin-uni/lib/util.js +++ b/packages/vue-cli-plugin-uni/lib/util.js @@ -1,3 +1,4 @@ +const path = require('path') let partialIdentifier = false module.exports = { getPartialIdentifier () { @@ -16,5 +17,17 @@ module.exports = { getAutomatorCode () { const automator = `@dcloudio/uni-${process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM}/dist/automator` return process.env.UNI_AUTOMATOR_WS_ENDPOINT ? `import '${automator}';` : '' + }, + getWatchOptions () { + return { + ignored: [ + /node_modules/, + path.resolve(process.env.UNI_INPUT_DIR, 'unpackage'), + path.resolve(process.env.UNI_INPUT_DIR, 'uniCloud'), + path.resolve(process.env.UNI_INPUT_DIR, 'unicloud'), + path.resolve(process.env.UNI_INPUT_DIR, 'cloudfunctions-aliyun'), + path.resolve(process.env.UNI_INPUT_DIR, 'cloudfunctions-tcb') + ] + } } } -- GitLab