9

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?

Community
  • 1
  • 1
Freewind
  • 193,756
  • 157
  • 432
  • 708

1 Answers1

2

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.

cartant
  • 57,105
  • 17
  • 163
  • 197