diff --git a/packages/vue-cli-plugin-uni/index.js b/packages/vue-cli-plugin-uni/index.js index a037f49abff6079026dbf6eaa5ad4ab73d0d0d16..2370cf980078afca6b57d85957b6a6d7e987d5be 100644 --- a/packages/vue-cli-plugin-uni/index.js +++ b/packages/vue-cli-plugin-uni/index.js @@ -91,12 +91,17 @@ module.exports = (api, options) => { ) ) { const migrate = require('@dcloudio/uni-migration') - const wxcomponents = path.resolve(process.env.UNI_INPUT_DIR, 'wxcomponents') - if (fs.existsSync(wxcomponents)) { // 转换 mp-weixin 小程序组件 - migrate(wxcomponents, false, { - silent: true // 不输出日志 - }) - } + const wxcomponentDirs = [path.resolve(process.env.UNI_INPUT_DIR, 'wxcomponents')] + global.uniModules.forEach(module => { + wxcomponentDirs.push(path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules', module, 'wxcomponents')) + }) + wxcomponentDirs.forEach(wxcomponentsDir => { + if (fs.existsSync(wxcomponentsDir)) { // 转换 mp-weixin 小程序组件 + migrate(wxcomponentsDir, false, { + silent: true // 不输出日志 + }) + } + }) } }