Closed jonathanpmast closed 9 years ago
From the readme:
When creating the browserify instance b you MUST set these properties in the constructor: var b = browserify({ cache: {}, packageCache: {}, fullPaths: true }) You can also just do: var b = browserify(watchify.args)
Does that solve your problem?
The cache
variable is used by module-deps. If you don't pass a cache
object like @ryanatkn suggests, you won't get the benefit of the cache. But as of v1.0.3, not passing it, won't cause watchify to throw.
It would appear that cache doesn't always get initialized to an empty object.
I was working with beefy on a browserify prototype and it would throw a null exception because the cache variable is undefined inside the invalidate method. This would happen as soon as watchify found a file change and called invalidate().
I was able to work around the issue by instantiating the cache variable if it wasn't found in browserify's options: var cache = b._options.cache || {};
I did a quick cursory look into the browserify source and couldn't see anywhere cache was created... but I'm probably not looking int he right place :( ...
This may be something that I'm doing wrong, too! :)