File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,9 +114,15 @@ const baseConfig: Options & {
114114
115115 // tsup@8.5.0 do not write to output atomically.
116116 // Thus, when building in parallel, some of the files will be emptied.
117- // We are writing output to /dist.tmp/ and copy everything back to /dist/.
117+
118+ // Writing output to /dist.tmp/ and copy everything back to /dist/ for better atomicity.
119+
118120 // "onSuccess" runs before DTS, we need to wait until *.d.ts are emitted.
119- onSuccess : `while [ -z "$(find ./dist.tmp -name '*.d.ts' -print -quit)" ]; do sleep 0.2; done; mkdir -p ./dist/ && cp ./dist.tmp/* ./dist/` ,
121+
122+ // All instances of tsup will try to copy at the same time and could fail with "cp: cannot create regular file './dist/...': File exists".
123+ // We will retry.
124+
125+ onSuccess : `while [ -z "$(find ./dist.tmp -name '*.d.ts' -print -quit)" ]; do sleep 0.2; done; mkdir -p ./dist/; until cp ./dist.tmp/* ./dist/; do sleep 0.5; done` ,
120126 outDir : './dist.tmp/'
121127} ;
122128
You can’t perform that action at this time.
0 commit comments