@@ -190,44 +190,39 @@ export function makeBaseBundleConfig(options) {
190190 return deepMerge ( sharedBundleConfig , isAddOn ? addOnBundleConfig : standAloneBundleConfig ) ;
191191}
192192
193- export function makeMinificationVariants ( existingConfigs ) {
193+ export function makeMinificationVariants ( baseConfig ) {
194194 const newConfigs = [ ] ;
195195
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 ;
198197
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+ ) ;
207203
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` ,
214208 } ,
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` ,
220214 } ,
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 ,
230224 } ) ;
225+ newConfigs . push ( mergedConfig ) ;
231226 } ) ;
232227
233228 return newConfigs ;
0 commit comments