@@ -190,44 +190,39 @@ export function makeBaseBundleConfig(options) {
190
190
return deepMerge ( sharedBundleConfig , isAddOn ? addOnBundleConfig : standAloneBundleConfig ) ;
191
191
}
192
192
193
- export function makeMinificationVariants ( existingConfigs ) {
193
+ export function makeMinificationVariants ( baseConfig ) {
194
194
const newConfigs = [ ] ;
195
195
196
- // ensure we've got an array of configs rather than a single config
197
- existingConfigs = Array . isArray ( existingConfigs ) ? existingConfigs : [ existingConfigs ] ;
196
+ const { plugins } = baseConfig ;
198
197
199
- existingConfigs . forEach ( existingConfig => {
200
- const { plugins } = existingConfig ;
201
-
202
- // The license plugin has to be last, so it ends up after terser. Otherwise, terser will remove the license banner.
203
- assert (
204
- getLastElement ( plugins ) . name === 'rollup-plugin-license' ,
205
- `Last plugin in given options should be \`rollup-plugin-license\`. Found ${ getLastElement ( plugins ) . name } ` ,
206
- ) ;
198
+ // The license plugin has to be last, so it ends up after terser. Otherwise, terser will remove the license banner.
199
+ assert (
200
+ getLastElement ( plugins ) . name === 'rollup-plugin-license' ,
201
+ `Last plugin in given options should be \`rollup-plugin-license\`. Found ${ getLastElement ( plugins ) . name } ` ,
202
+ ) ;
207
203
208
- const bundleVariants = [
209
- {
210
- output : {
211
- file : `${ existingConfig . output . file } .js` ,
212
- } ,
213
- plugins,
204
+ const bundleVariants = [
205
+ {
206
+ output : {
207
+ file : `${ baseConfig . output . file } .js` ,
214
208
} ,
215
- {
216
- output : {
217
- file : ` ${ existingConfig . output . file } .min.js` ,
218
- } ,
219
- plugins : insertAt ( plugins , - 2 , terserPlugin ) ,
209
+ plugins ,
210
+ } ,
211
+ {
212
+ output : {
213
+ file : ` ${ baseConfig . output . file } .min.js` ,
220
214
} ,
221
- ] ;
222
-
223
- bundleVariants . forEach ( variant => {
224
- const mergedConfig = deepMerge ( existingConfig , variant , {
225
- // this makes it so that instead of concatenating the `plugin` properties of the two objects, the first value is
226
- // just overwritten by the second value
227
- arrayMerge : ( first , second ) => second ,
228
- } ) ;
229
- newConfigs . push ( mergedConfig ) ;
215
+ plugins : insertAt ( plugins , - 2 , terserPlugin ) ,
216
+ } ,
217
+ ] ;
218
+
219
+ bundleVariants . forEach ( variant => {
220
+ const mergedConfig = deepMerge ( baseConfig , variant , {
221
+ // this makes it so that instead of concatenating the `plugin` properties of the two objects, the first value is
222
+ // just overwritten by the second value
223
+ arrayMerge : ( first , second ) => second ,
230
224
} ) ;
225
+ newConfigs . push ( mergedConfig ) ;
231
226
} ) ;
232
227
233
228
return newConfigs ;
0 commit comments