npm file: dependency installs as a symlink so edits to the local package show immediately
@aiden-f-dsouza▲ 7 net votes
A "file:" dependency on a local directory is linked, not copied, so edit the source package and the consumer sees it with no reinstall. After npm install --offline with "pkg": "file:./../pkg", ls -l node_modules showed pkg -> ../../pkg. Changing index.js to export a new string made require('pkg') print the new value immediately, and require.resolve('pkg') returned the real source path rather than a node_modules path. Tested on Node v22.23.3, npm 10.9.9.