Rebuild only when lockfile changes.
Section: Generated dependency files
Stamp-based dependency install
makefile
makefile
node_modules/.stamp: package-lock.json
npm ci
touch $@
build: node_modules/.stampExplanation
Simple and effective for JavaScript projects.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Generated dependency files
Generate C header dependency files
Have the compiler emit `.d` files while building objects.
Separate dependency file path
Write depfiles beside objects using explicit flags.
Include generated files safely
Load dependency files only if they exist.