-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does browserify make use of a cache
option?
#1004
Comments
The caching options are forwarded along to module-deps: https://github.com/substack/module-deps/blob/master/index.js You could roll your own cache from disk or some such but it would probably be much simpler to just run watchify from inside the docker container. Maybe just use |
Using Running watchify locally is, of course, an option but our gulpfile includes several image processing steps that for some reason produce slightly different results on some machines. We like the idea of putting that issue to rest by developing in matching environments. I tried out https://github.com/benbria/uber-watchify which adds a cache file option, but I worry that it might not be well maintained going forward. Thanks for your reply. Maybe this issue will gather some input from others in the same situation too. |
I'm not really sure if this will help you but I use browserify with a caching mechanism that I stole from watchify.
Watchify uses chokidar underneath so if that doesn't work for watching files on NFS or virtual box shares you will need to substitute it out for watch code that does. |
Thanks @startswithaj. I'm playing with the techniques you've demoed here but still can't get a working cache. Even when I set the Your example definitely points me in the right direction for implementing watchify to accomplish my goal but I still feel that a persistent on-disk cache is better so I'm going to keep working in that direction. |
Do you have the fullPaths options set? ...Otherwise it has no way to reference the cache object for the corresponding file. |
I do have Even when I change the condition on line 18 to read |
As @substack mentioned before the cache is used by module-deps more specifically here in the
So basically if there is a cache and the cache has an index for the file its trying to retrieve, it returns the source from the cache object. Your gist code does not write the cache file in the same way as uber-watchify. uber-watchify does some tricky stuff and I guess he's doing that for a reason. https://github.com/benbria/uber-watchify/blob/master/index.js#L222
|
Also, you might be already be, but I think if you |
Hi,
I've been perusing the source of both browserify and watchify hoping to find a good way to speed up my builds using a cache. I want to take advantage of watchify's caching feature but without having to run a long-running process.
I found a couple things which make it look like browserify might have some related features. For example, https://github.com/substack/node-browserify/blob/47c6933e711567de761c73fe81165223c7873433/test/double_bundle_parallel_cache.js contains a
cache
option. And https://github.com/substack/watchify/blob/master/index.js showscache
andpackageCache
as options taken from the browserify instance but I haven't found where those are actually used. Browserify's source doesn't mention a cache option that I can see and watchify doesn't appear to actually make use of the cache that it maintains.The reason behind this is that my team is migrating our stack to Docker and for us the best workflow would involve watching files on our host machine, then triggering a full rebuild of our assets in a container upon changes.
Thanks!
The text was updated successfully, but these errors were encountered: