From the document of watchify, I see:
When creating the browserify instance b you MUST set these properties in the constructor:
var b = browserify({ cache: {}, packageCache: {}, fullPaths: true })
The 3 parameters cache: {}, packageCache: {}, fullPaths: true
are for watchify, but why we should pass them to browserify
instead of passing to watchify
?
They are passed to browserify
because the cache
and packageCache
options are forwarded to module-deps
.
There is a comment from the author here:
The caching options are forwarded along to module-deps:
https://github.com/substack/module-deps/blob/master/index.js
The contents of cache
are not modified in module-deps
, so its being passed is likely to be for performance reasons. However, the contents of packageCache
are modified, so it seems there is some interaction between module-deps
and watchify
via the shared packageCache
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With