Skip to content

Commit

Permalink
Make the CLI run generate/output in serial
Browse files Browse the repository at this point in the history
As a temporary workaround for concurrency issues in the plugin
driver.

See issue #3174
  • Loading branch information
marijnh committed Oct 29, 2019
1 parent 53fb6fe commit 748ac7c
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cli/run/build.ts
Expand Up @@ -66,9 +66,10 @@ export default function build(
});
}

return Promise.all(outputOptions.map(output => bundle.write(output) as Promise<any>)).then(
() => bundle
);
return outputOptions.reduce(
(prev, output) => prev.then(() => bundle.write(output) as Promise<any>),
Promise.resolve()
).then(() => bundle)
})
.then((bundle: RollupBuild | null) => {
if (!silent) {
Expand Down
1 change: 1 addition & 0 deletions test/cli/samples/emit-file-multiple-dirs/.tern-port
@@ -0,0 +1 @@
46665
4 changes: 4 additions & 0 deletions test/cli/samples/emit-file-multiple-dirs/_config.js
@@ -0,0 +1,4 @@
module.exports = {
description: 'writes files emitted by plugins in different output dirs',
command: 'rollup -c'
};
@@ -0,0 +1,3 @@
'use strict';

assert.equal( ANSWER, 42 );
@@ -0,0 +1 @@
abc
@@ -0,0 +1 @@
assert.equal( ANSWER, 42 );
@@ -0,0 +1 @@
abc
1 change: 1 addition & 0 deletions test/cli/samples/emit-file-multiple-dirs/main.js
@@ -0,0 +1 @@
assert.equal( ANSWER, 42 );
18 changes: 18 additions & 0 deletions test/cli/samples/emit-file-multiple-dirs/rollup.config.js
@@ -0,0 +1,18 @@
export default {
input: "main.js",
output: [
{
dir: "_actual/dist1",
format: "cjs"
},
{
dir: "_actual/dist2",
format: "esm"
}
],
plugins: [{
generateBundle() {
this.emitFile({type: "asset", fileName: "myfile", source: "abc"})
}
}]
}

0 comments on commit 748ac7c

Please sign in to comment.