Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/multi-entry/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export default function multiEntry(conf = {}) {
buildStart(options) {
const patterns = config.include.concat(config.exclude.map((pattern) => `!${pattern}`));
const entries = patterns.length
? matched(patterns, { realpath: true }).then((paths) => paths.map(exporter).join('\n'))
? matched(patterns, { realpath: true }).then((paths) =>
paths.sort().map(exporter).join('\n')
)
: Promise.resolve('');

virtualisedEntry = virtual({ [options.input]: entries });
Expand Down
16 changes: 16 additions & 0 deletions packages/multi-entry/test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,19 @@ test('makes a bundle with entryFileName as the output.entryFileName when preserv
t.truthy(nonVirtualFiles.find(({ fileName }) => fileName === 'entry-0.js'));
t.truthy(nonVirtualFiles.find(({ fileName }) => fileName === 'entry-1.js'));
});

test('deterministic output, regardless of input order', async (t) => {
const bundle1 = await rollup({
input: 'test/fixtures/{0,1}.js',
plugins: [multiEntry()]
});
const code1 = await getCode(bundle1);

const bundle2 = await rollup({
input: 'test/fixtures/{1,0}.js',
plugins: [multiEntry()]
});
const code2 = await getCode(bundle2);

t.is(code1, code2);
});
Loading