[英]Watchify not looking at changes in parent folders
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. 现在,Watchify的多个实例正在针对所有这些实例运行,如果我对其中的任何一个进行了更改,该应用程序都将使用browserify和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.
这里的想法是让所有应用程序仅获得自己的编译文件,而不是包含所有应用程序的单个巨大的javascript文件。 Good so far!
目前很好!
Now the entry point, main.js , of each app starts out something like this 现在,每个应用程序的入口main.js开始都是这样的
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. 如果我对应用程序特定的something.js进行了更改,则将重新构建该应用程序,并且一切都会按预期进行。 However, if I update something in tools.js , which have several apps depending on it, that doesn't happen.
但是,如果我在tools.js中更新了一些依赖于它的应用程序,则不会发生。 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. 如果我在tools.js中进行了更改,则必须转到每个应用程序,然后在其中重新保存一些文件,以便对其进行重建并获得我所做的更改。
Is Watchify only looking at subfolders and not parent folders or could there be something else going on here? Watchify是仅查看子文件夹而不查看父文件夹,还是在这里进行其他操作?
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. Watchify将监视指定的文件夹,并在发生某些更改时触发回调。
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.
可能重新定义需要注意的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.