22
33const { _, tryRequire, fs } = require ( '@micro-app/shared-utils' ) ;
44const createService = require ( '../utils/createService' ) ;
5- const CONSTANTS = require ( '../constants' ) ;
5+ const { BUILT_IN } = require ( '../constants' ) ;
66
77// 以 vue-cli 配置为主
88module . exports = function chainDefault ( api , vueConfig , options ) {
@@ -14,7 +14,9 @@ module.exports = function chainDefault(api, vueConfig, options) {
1414 ]
1515 . forEach ( key => {
1616 if ( ! _ . isUndefined ( options [ key ] ) ) {
17- vueConfig [ key ] = options [ key ] ;
17+ if ( _ . isUndefined ( vueConfig [ key ] ) ) { // vueConfig 中是否已经存在配置了
18+ vueConfig [ key ] = options [ key ] ;
19+ }
1820 }
1921 } ) ;
2022
@@ -80,8 +82,11 @@ module.exports = function chainDefault(api, vueConfig, options) {
8082 // 注册插件
8183 service . registerPlugin ( {
8284 id : 'vue-cli-plugin:plugin-command-return-webpack-chain' ,
83- [ CONSTANTS . builtIn ] : true ,
85+ [ BUILT_IN ] : true ,
8486 apply ( _api ) {
87+ // 修改默认配置
88+
89+
8590 _api . registerCommand ( 'return-webpack-chain' , {
8691 description : 'return config of webpack-chain.' ,
8792 usage : 'micro-app return-webpack-chain' ,
@@ -93,6 +98,6 @@ module.exports = function chainDefault(api, vueConfig, options) {
9398 } ) ;
9499
95100 // 同步扩充 webpack-chain config
96- return service . runSync ( 'return-webpack-chain' , { _ : [ ] , target : CONSTANTS . skipTarget } ) ;
101+ return service . runSync ( 'return-webpack-chain' ) ;
97102 } ) ;
98103} ;
0 commit comments