-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Since 0.12.17, --watch fail silently when running under lerna #1885
Comments
Watch mode in esbuild is terminated when stdin is closed. Closing stdin indicates to esbuild that you want to end watch mode. One way to fix this is to change Lerna itself. The Another way to fix this is to avoid closing stdin: diff --git a/packages/app/package.json b/packages/app/package.json
index 5424c2b..2ac3235 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -6,7 +6,7 @@
"main": "lib/index.js",
"scripts": {
"build": "esbuild --version && esbuild src/index.js --bundle --outfile=lib/index.js",
- "start": "esbuild --version && esbuild src/index.js --bundle --outfile=lib/index.js --watch"
+ "start": "esbuild --version && sleep 9999999999 | esbuild src/index.js --bundle --outfile=lib/index.js --watch"
},
"author": "",
"license": "MIT", |
Duplicate of #1511 |
See solution here evanw/esbuild#1885 (comment)
See solution here evanw/esbuild#1885 (comment)
See solution here evanw/esbuild#1885 (comment)
In case you need a cross-platform solution check out ours above, it uses JS Changing the stdio in Lerna has some other difficulties seems, comments here: |
instead of open-process hack evanw/esbuild#1885
0.12.17
latest
,0.13
,0.12
0.12.16
,0.12.0
,0.11
14.17.6
/6.14.15
and16.13.1
/8.1.2
When using
lerna run <scriptname> --stream
to runesbuild --watch
with>= 0.12.17
, it quit silently. I am usinglerna@4.0.0
(latest), it was released about 10 months ago, which is earlier than0.12.17
.0.12.16
In the screenshot above, the root package of the monorepo will run
esbuild@0.12.16 --watch
. ESBuild will say "build finished, watching for changes".0.12.17
In the screenshot above, I updated to
esbuild@0.12.17
. When running it through lerna, ESBuild fail silently and quit immediately. There are no output files produced.However, when running without
--watch
(vianpm run build
), it works without issues, regardless of whether lerna's--parallel
and--stream
flag is set or not.Repro
I have prepared a bare minimal repo, https://github.com/compulim/experiment-lerna-esbuild. Please use GitHub Codespaces to try it out on the cloud.
After clone
npm install
at root to prepare the repositorynpm start
esbuild --version && esbuild src/index.js --bundle --outfile=lib/index.js --watch
ESBuild is located under
packages/app
. To change version ofesbuild
:cd packages/app
npm install esbuild@0.12.6
By default, GitHub Codespaces use Node 14. You can use
nvm
to change its version.Workaround
When running
esbuild
, useconcurrently
to wrap around it.concurrently
will not closestdin
on start.In the bare minimal repo, modify
packages/app/package.json
:The text was updated successfully, but these errors were encountered: