You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
server:serve is not restarted even if the dependency has been changed
This is a simplistic example of a build process that in a real world would be running tsc instead of just copying a file.
The serve command it pretty realistic for an express application.
Different kind of persistent tasks
I don't think this is covered in the configuration but there a difference between node and node --watch. The first one needs to be restarted when a dependency has been change and that later is responsible for taking care of updates on its own. In this case however I'm more interested in the first once since turbo is the only one with knowledge of the dependency chain and the one that knows when it's needed to restart or not.
How to run
npx turbo@1.13.4-canary.2 watch serve
• Packages in scope: server
• Running serve in 1 packages
• Remote caching disabled
server:serve: cache bypass, force executing 82a3aea137e3fb4d
server:build: cache hit (outputs already on disk), replaying logs 7fccac5d6afa1a65
server:build:
server:build: > server@1.0.0 build
server:build: > mkdir -p dist && cp src/index.js dist/.
server:build:
Tasks: 1 successful, 1 total
Cached: 1 cached, 1 total
Time: 48ms >>> FULL TURBO
server:serve:
server:serve: > server@1.0.0 serve
server:serve: > node dist/index.js
server:serve:
server:serve: Server is running v1.0.0 1
server:serve: Server is running v1.0.0 2
Trigger a change in the build dependency
E.g. change applicationVersion in src/index.js to something else
server:build: cache miss, executing 75d7ab0d4cd54cf3
server:build:
server:build: > server@1.0.0 build
server:build: > mkdir -p dist && cp src/index.js dist/.
server:build:
Tasks: 1 successful, 1 total
Cached: 0 cached, 1 total
Time: 305ms
server:serve: Server is running v1.0.0 6
server:serve: Server is running v1.0.0 7
As you can see the v1.0.0 is still being logged even if the dependency has been rebuilt.
References
I tried to remove the dependency on build from the serve task to simplify the dependency chain but then it won't start at all running the watch command.
Problem
server:serve
is not restarted even if the dependency has been changedThis is a simplistic example of a build process that in a real world would be running
tsc
instead of just copying a file.The serve command it pretty realistic for an express application.
Different kind of persistent tasks
I don't think this is covered in the configuration but there a difference between
node
andnode --watch
. The first one needs to be restarted when a dependency has been change and that later is responsible for taking care of updates on its own. In this case however I'm more interested in the first once sinceturbo
is the only one with knowledge of the dependency chain and the one that knows when it's needed to restart or not.How to run
Trigger a change in the build dependency
E.g. change
applicationVersion
insrc/index.js
to something elseAs you can see the
v1.0.0
is still being logged even if the dependency has been rebuilt.References
I tried to remove the dependency on
build
from theserve
task to simplify the dependency chain but then it won't start at all running the watch command.It looks like there's some code in place to actually abort the persisted task when changed, but I'm not familiar with the implementation?
https://github.com/vercel/turbo/blob/7a9d83956cc6c0145ed5abdedb2080dec753d09b/crates/turborepo-lib/src/run/watch.rs#L291
There are some issues open that's related to the dependency chain but I'm not sure if it could be related?
vercel/turbo#8051
The text was updated successfully, but these errors were encountered: