Created by: alexxyzeng
sometimes i found out react-scripts buld
hangs under certain circumstances, like:
when i changed process.exit(1) to process.exitCode = 1, it can end up with failure:
According to https://nodejs.org/dist/latest-v16.x/docs/api/process.html#processexitcode_1:
Rather than calling process.exit() directly, the code should set the process.exitCode and allow the process to exit naturally by avoiding scheduling any additional work for the event loop:
I also find that webpack
and webpack-cli
also have simlar issues fixed:
fix: fix webpack hanging under certain circumstance
Fix webpack hanging under certain circumstance, use process.exitCode instead of process.exit in compilerCallback
misc(refactor): reduce code duplication use process.exitCode instead of process.exit