Open ObliviousHarmony opened 8 months ago
Isn't this solved by setting cascade to false?
In our case, we're using pnpm
for task orchestration and wireit
for caching. This is preferable to using wireit
for both for us as it provides developers with a consistent syntax for running commands via pnpm --filter=<project-name>
.
As an example, let's take a look at this configuration in two projects:
project-a/package.json
{
"wireit": {
"copy-assets": {
"command": "rm -rf assets/client && cp -r node_modules/project-b/build assets/client",
"allowUsuallyExcludedPaths": true,
"files": [
"node_modules/project-b/build"
]
}
}
}
project-b/package.json
{
"wireit": {
"watch": {
"command": "webpack --watch",
"service": true
}
}
}
You would also see the same problem with the above configs if you opened two separate terminals and ran npm run watch
in one and npm run copy-assets --watch
in the other. Due to the debouce of 0
and webpack
progressively outputting files, the copy-assets
command is triggered multiple times. If we bumped the debounce it would let webpack
finish and only run copy-assets
once.
Ah ok that makes sense!
When using something like
webpack --watch
in a service it can cause conflicts with Wireit's--watch
option. The build tool progressively outputs and can trigger multiple rebuilds successively in downstream packages. We're currently implementing this by usingnodemon
but that feels like an unnecessary extra step when we have watch support already inwireit
.I noticed that there's currently a debounce implemented in the watcher already with a value of
0
and it would be great if we could set this to a configurable value. Since--watch
itself is not a configuration option but is rather an option I think it makes sense to also make this an option.--watch --delay <ms>
seems appropriate. Havingdelay
in thepackage.json
doesn't feel like it makes sense since it only applies to--watch
.