addWatchTarget
doesn't work with npm-run-all
or concurrently
#1736
Labels
addWatchTarget
doesn't work with npm-run-all
or concurrently
#1736
Describe the bug
When attempting to run Eleventy with a tool like
concurrently
ornpm-run-all
, Eleventy doesn't appear to watch targets specified viaaddWatchTarget
. However, it does work in other parallel use cases. Some specifics:I am running PostCSS with its
--watch
flag to watch my CSS files for changes. Similarly, I'm running Eleventy with its--serve
flag to watch my Eleventy files for changes. These are done via two NPM scripts (npm run watch:css
andnpm run watch:site
). I'm running the two scripts in parallel usingnpm run start
.I am using PostCSS to generate a file from
./src/_assets/css/style.css
to./.cache/compiled.css
. I am using Eleventy'saddWatchTarget
feature to watch for changes to the./.cache/compiled.css
file. When changes are detected, Eleventy should trigger a rebuild. I am using PostCSS's verbose output to ensure that PostCSS is compiling the file, both when initially runningnpm run start
and on file changes. The output confirms that PostCSS is recompiling as expected.(It may be worth noting that I am choosing to set
setUseGitIgnore
tofalse
, and I'm using a.eleventyignore
file instead, which I've done in order to watch.cache/
, a directory otherwise ignored.)When using a script like
npm run watch:css & npm run watch:site
, Eleventy detects changes tocompiled.css
and rebuilds successfully. If I runnpm run watch:css
andnpm run watch:site
in separate terminal windows, I can achieve the same success.When running the same scripts together using either
concurrently
ornpm-run-all
, Eleventy does not detect changes tocompiled.css
.To Reproduce
Steps to reproduce the behavior:
npm install
npm run start
./.cache/compiled.css
.npm-run-start
npm run watch:site & npm run watch:css
Expected behavior
My expectation is that running these two scripts with
concurrently
ornpm-run-all
would behave identically to running the scripts withnpm run watch:css
&npm run watch:site
.Environment:
v0.12.1
v15.14.0
v7.7.6
Additional context:
While I'd understand assuming the issue may lie with
npm-run-all
orconcurrently
, Eleventy is the only build tool I've had this issue with. PostCSS, Dart Sass, & Rollup don't seem to have the same issue.The text was updated successfully, but these errors were encountered: