This is currently not possible via npm link . The problem is that if you only install prod dependencies in this dependency, you can link it, but you can no longer develop this dependency (since devDependencies is missing). And vice versa: if you install devDependencies, you can no longer link.
Solution: a package called npm-local-development at https://github.com/marcj/npm-local-development
It basically does the same as npm link , but bypasses the devDependency limitation by setting up a file viewer and automatically synchronizes file changes in the background, excluding all devDependencies / peerDependencies.
- You install npm-local-development: npm i -g npm-local-development
- You create a file called
.links.json in your root package. You write each package name with its local relative path to the folder, like so
{"@ shared / core": "../../my-library-repo/packages/core"}
- Open a console and run
npm-local-development in this root package. Let it work in the background.
Disclaimer: I am the author of this free open source project.
source share