File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,9 @@ export default function multiEntry(conf = {}) {
6060 buildStart ( options ) {
6161 const patterns = config . include . concat ( config . exclude . map ( ( pattern ) => `!${ pattern } ` ) ) ;
6262 const entries = patterns . length
63- ? matched ( patterns , { realpath : true } ) . then ( ( paths ) => paths . map ( exporter ) . join ( '\n' ) )
63+ ? matched ( patterns , { realpath : true } ) . then ( ( paths ) =>
64+ paths . sort ( ) . map ( exporter ) . join ( '\n' )
65+ )
6466 : Promise . resolve ( '' ) ;
6567
6668 virtualisedEntry = virtual ( { [ options . input ] : entries } ) ;
Original file line number Diff line number Diff line change @@ -131,3 +131,19 @@ test('makes a bundle with entryFileName as the output.entryFileName when preserv
131131 t . truthy ( nonVirtualFiles . find ( ( { fileName } ) => fileName === 'entry-0.js' ) ) ;
132132 t . truthy ( nonVirtualFiles . find ( ( { fileName } ) => fileName === 'entry-1.js' ) ) ;
133133} ) ;
134+
135+ test ( 'deterministic output, regardless of input order' , async ( t ) => {
136+ const bundle1 = await rollup ( {
137+ input : 'test/fixtures/{0,1}.js' ,
138+ plugins : [ multiEntry ( ) ]
139+ } ) ;
140+ const code1 = await getCode ( bundle1 ) ;
141+
142+ const bundle2 = await rollup ( {
143+ input : 'test/fixtures/{1,0}.js' ,
144+ plugins : [ multiEntry ( ) ]
145+ } ) ;
146+ const code2 = await getCode ( bundle2 ) ;
147+
148+ t . is ( code1 , code2 ) ;
149+ } ) ;
You can’t perform that action at this time.
0 commit comments