@@ -156,7 +156,7 @@ function sharedCode(bundle: BundleBuildConfig): RollupOptions {
156156
157157 return {
158158 input : bundle . sharedCharts . input ,
159- plugins : [ ... stdPlugins ( bundle ) , sharedBundleLicensePlugin ( bundle , true ) ] ,
159+ plugins : stdPlugins ( bundle , true ) ,
160160 // Mark reactPlotly as external to not include react-plotly.js in bundle.
161161 // Mark plotly as external to not include plotly.js in bundle.
162162 external : [ ...bundle . external , bundle . reactPlotly . input , bundle . plotly . input ] ,
@@ -180,7 +180,7 @@ function reactPlotly(bundle: BundleBuildConfig): RollupOptions {
180180 input : bundle . reactPlotly . input ,
181181 // Mark plotly as external to not include plotly.js in bundle.
182182 external : [ ...bundle . external ] ,
183- plugins : [ ... stdPlugins ( bundle ) , sharedBundleLicensePlugin ( bundle , false ) ] ,
183+ plugins : stdPlugins ( bundle , false ) ,
184184 output : [ esmOutput , amdOutput ]
185185 } ;
186186}
@@ -221,7 +221,7 @@ function plotly(bundle: BundleBuildConfig): RollupOptions {
221221 ] ,
222222 verbose : true
223223 } ) ,
224- sharedBundleLicensePlugin ( bundle , false )
224+ ... sharedBundleLicensePlugin ( bundle , false )
225225 ] ,
226226 output : [ esmOutput , amdOutput ]
227227 } ;
@@ -239,12 +239,12 @@ function plotly(bundle: BundleBuildConfig): RollupOptions {
239239 * @param bundle - The build config (needs isProd and amdDir)
240240 * @param isLastBundle - When true, write accumulated deps to disk
241241 */
242- function sharedBundleLicensePlugin ( bundle : BundleBuildConfig , isLastBundle : boolean ) : Plugin | null {
242+ function sharedBundleLicensePlugin ( bundle : BundleBuildConfig , isLastBundle : boolean ) : Plugin [ ] {
243243 if ( ! bundle . isProd ) {
244- return null ;
244+ return [ ] ;
245245 }
246246
247- return license ( {
247+ return [ license ( {
248248 thirdParty : {
249249 includePrivate : true ,
250250 output : ( deps : Dependency [ ] ) => {
@@ -275,7 +275,7 @@ function sharedBundleLicensePlugin(bundle: BundleBuildConfig, isLastBundle: bool
275275 }
276276 }
277277 }
278- } ) ;
278+ } ) ] ;
279279}
280280
281281/** Utils */
@@ -286,11 +286,12 @@ const isProd = (args: Args): boolean => !!args.configProduction;
286286 * IMPORTANT: Please use this only for common plugins.
287287 * All bundle specific plugins should be defined in the bundle function.
288288 */
289- const stdPlugins = ( config : { isProd : boolean } ) : Plugin [ ] => [
289+ const stdPlugins = ( bundle : BundleBuildConfig , isLastBundle : boolean ) : Plugin [ ] => [
290290 nodeResolve ( ) ,
291291 commonjs ( ) ,
292292 replace ( {
293- "process.env.NODE_ENV" : JSON . stringify ( config . isProd ? "production" : "development" )
293+ "process.env.NODE_ENV" : JSON . stringify ( bundle . isProd ? "production" : "development" )
294294 } ) ,
295- tarser ( )
295+ tarser ( ) ,
296+ ...sharedBundleLicensePlugin ( bundle , isLastBundle )
296297] ;
0 commit comments