Per this answer, when you reference a local dependency in package.json
the local package will be copied to node_modules
. This is not ideal when I'm developing a package and just referencing it from another project as I want to verify the library works correctly within another project. It seems every time I make a change to the library, I have to go back to my consuming project, delete the node_modules/my-library
folder and rerun npm install
each time for it to copy the library back. If I don't delete the folder first it doesn't seem to copy the latest version over.
If I develop directly inside node_modules/my-library
it's not ideal because that folder isn't version controller, unlike the local folder referenced in package.json
.
Another option would be to create an example project within the my-library
repo, but I'd prefer to go that route as a last resort.