v0.15.7
-
Add
--watch=forever
to allow esbuild to never terminate (#1511, #1885)Currently using esbuild's watch mode via
--watch
from the CLI will stop watching if stdin is closed. The rationale is that stdin is automatically closed by the OS when the parent process exits, so stopping watch mode when stdin is closed ensures that esbuild's watch mode doesn't keep running forever after the parent process has been closed. For example, it would be bad if you wrote a shell script that didesbuild --watch &
to run esbuild's watch mode in the background, and every time you run the script it creates a newesbuild
process that runs forever.However, there are cases when it makes sense for esbuild's watch mode to never exit. One such case is within a short-lived VM where the lifetime of all processes inside the VM is expected to be the lifetime of the VM. Previously you could easily do this by piping the output of a long-lived command into esbuild's stdin such as
sleep 999999999 | esbuild --watch &
. However, this possibility often doesn't occur to people, and it also doesn't work on Windows. People also sometimes attempt to keep esbuild open by piping an infinite stream of data to esbuild such as withesbuild --watch </dev/zero &
which causes esbuild to spin at 100% CPU. So with this release, esbuild now has a--watch=forever
flag that will not stop watch mode when stdin is closed. -
Work around
PATH
withoutnode
in install script (#2519)Some people install esbuild's npm package in an environment without the
node
command in theirPATH
. This fails on Windows because esbuild's install script runs theesbuild
command before exiting as a sanity check, and on Windows theesbuild
command has to be a JavaScript file because of some internal details about how npm handles thebin
folder (specifically theesbuild
command lacks the.exe
extension, which is required on Windows). This release attempts to work around this problem by usingprocess.execPath
instead of"node"
as the command for running node. In theory this means the installer can now still function on Windows if something is wrong withPATH
.