Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why we should pass watchify arguments to browserify?

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?

like image 331
Freewind Avatar asked Feb 08 '15 15:02

Freewind


1 Answers

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.

like image 92
cartant Avatar answered Dec 19 '22 13:12

cartant