I have a snowpack project that I started from the blank template. My index.js file calls a function from another module I'm developing that I have installed using npm link
.
When I change a file in the other module, it doesn't get updated in snowpack. Even when I restart the dev server, it doesn't update. I have to restart snowpack with the --reload
argument to clear the cache.
How do I make sure changes to files in node_modules
get recognized by snowpack so that they are rebuilt?
Unfortunately the way Snowpack works is it caches the node_modules
dependencies and rarely rebuilds them.
In the documentation section Using NPM Dependencies
- Because your dependencies rarely change, Snowpack rarely needs to rebuild them.
Each build tool has its pros and cons, and Snowpack is not going to work for you, in this instance where you still need to update the linked dependency.
You might want to look at other build tools like Webpack. Here is stack overflow answer on correctly configure Webpack to watch only for the linked dependency.
It seems that even the Parcel 2 doesn't detect changes in linked dependencies.