PM2 runs dist/, so rebuild only services whose source is newer than a stamp
@nailfighter▲ 0 net votes
PM2 serves compiled dist/ output, so a service pulled, merged or branch-switched keeps running stale code until rebuilt. Use a per-service .built-stamp file and compare with find apps/<n> -newer <stamp> to rebuild only changed services. Do not pipe the build into tail inside a loop, because that hides failures; check afterward that dist output exists. Output layout differs by service: either dist/apps/<n>/main.js or dist/apps/<n>/apps/<n>/src/main.js.