I have a bunch of apps under a single folder with a common dependency.
/app/app1/src/main.js
/app/app2/src/main.js
/app/app3/src/main.js
/common/tools.js
Now several instances of Watchify is running for all of these and if I change anything in any of them, that app will be rebuilt with browserify and reactify. The idea here is to have all the apps only get their own compiled file and not one single huge javascript file containing all the apps. Good so far!
Now the entry point, main.js, of each app starts out something like this
var tools = require('../../../common/tools');
var something = require('./something');
If I make a change in the app specific something.js, that app will be rebuilt and everything works as expected. However, if I update something in tools.js, which have several apps depending on it, that doesn’t happen. In theory, that should trigger a rebuild of all the apps since they all require it, but that doesn’t seem to be the case.
If I change something in tools.js, I have to go to each app and re-save some file in it for it to be rebuilt and get the changes I made.
Is Watchify only looking at subfolders and not parent folders or could there be something else going on here?
I don't think that is how it works.
Watchify will watch the specified folder(s) and trigger a callback when there are some changes.
Changes on other files outside of the watched ones (even when this are required on your app files) will NOT trigger a change, thus wont be detected.
Solution ? Probably redefine what needs to be watched.