@@ -115,20 +115,25 @@ var Project = function () {
115
115
116
116
// 获取项目配置中的插件
117
117
var configMethod = _this2 . _requireUncached ( sysPath . join ( _this2 . cwd , _this2 . configFile ) ) ;
118
+ var ykitConfigStartWith = 'ykit-config-' ;
118
119
if ( Array . isArray ( configMethod . plugins ) ) {
119
120
_this2 . plugins = configMethod . plugins ;
120
121
}
121
122
122
123
// 通配置文件名获取插件
123
124
if ( _this2 . extendConfig && _this2 . extendConfig !== 'config' ) {
124
- var pluginName = 'ykit-config-' + _this2 . extendConfig ;
125
+ var pluginName = ykitConfigStartWith + _this2 . extendConfig ;
125
126
if ( _this2 . plugins . indexOf ( pluginName ) === - 1 && _this2 . plugins . indexOf ( '@qnpm/' + pluginName ) === - 1 ) {
126
127
_this2 . plugins . push ( pluginName ) ;
127
128
}
128
129
}
129
130
130
131
// 通过插件扩展配置
131
132
_this2 . plugins . map ( function ( pluginName ) {
133
+ if ( pluginName . indexOf ( ykitConfigStartWith ) === - 1 ) {
134
+ pluginName = ykitConfigStartWith + pluginName ;
135
+ }
136
+
132
137
var localSearchPath = sysPath . join ( _this2 . cwd , 'node_modules/' , pluginName ) ;
133
138
var localSearchPathQnpm = sysPath . join ( _this2 . cwd , 'node_modules/' , '@qnpm/' + pluginName ) ;
134
139
var pluginPath = '' ;
@@ -165,9 +170,7 @@ var Project = function () {
165
170
_module2 . config . call ( userConfig , options , _this2 . cwd ) ;
166
171
}
167
172
} else {
168
- if ( _this2 . extendConfig ) {
169
- warn ( '没有找到 ykit-config-' + _this2 . extendConfig + ' 配置插件.' ) ;
170
- }
173
+ warn ( '没有找到 ' + pluginName + ' 配置插件.' ) ;
171
174
}
172
175
}
173
176
} ) ;
@@ -205,7 +208,7 @@ var Project = function () {
205
208
this . config . setExports ( exports ) ;
206
209
this . config . setCompiler ( userConfigObj . modifyWebpackConfig ) ;
207
210
this . config . setSync ( userConfigObj . sync ) ;
208
- this . setCommands ( userConfigObj . command ) ;
211
+ this . setCommands ( configMethod . commands || userConfigObj . command ) ; // 后者兼容以前形式
209
212
} ;
210
213
211
214
// 如果传入的是一个简单数组
0 commit comments