@samitouri / QOS-React-2 / commits / f4ac680c7a

Fixed broken build script --unsafe-partial flag (#22324)

This flag was broken due to a buggy race case in the ncp() command. The fix is amittedly a hack but improves on the existing behavior (of leaving the workspace in a broken state).

Brian Vaughn committed Sep 15, 2021 at 13:32 UTC f4ac680c7a1db67cae2659f531bb5531833f5c2f
1 file changed +5 -2
scripts/rollup/utils.js
+5 -2
@@ -15,9 +15,12 @@ function asyncCopyTo(from, to) {
15 if (error) {
16 // Wrap to have a useful stack trace.
17 reject(new Error(error));
18 - return;
18 + } else {
19 + // Wait for copied files to exist; ncp() sometimes completes prematurely.
20 + // For more detail, see github.com/facebook/react/issues/22323
21 + // Also github.com/AvianFlu/ncp/issues/127
22 + setTimeout(resolve, 10);
23 }
20 - resolve();
24 });
25 })
26 );