From 77090a4fb113074bfe279bce569cd8188ad65a18 Mon Sep 17 00:00:00 2001 From: Colin GILLE Date: Fri, 11 Oct 2019 21:07:15 +0200 Subject: [PATCH] Fix cache without cached file Make the in memory cache actually work, at least with the latest browsersync version. --- lib/BrowserifyCache.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/BrowserifyCache.js b/lib/BrowserifyCache.js index 3ce6fdc..c551ef2 100644 --- a/lib/BrowserifyCache.js +++ b/lib/BrowserifyCache.js @@ -20,7 +20,12 @@ function BrowserifyCache(b, opts) { // load cache from file specified by cacheFile opt var cacheFile = opts.cacheFile || opts.cachefile || b._options && b._options.cacheFile || null; - var cacheData = loadCacheData(b, cacheFile); + var cacheData; + if (cacheFile) { + cacheData = loadCacheData(b, cacheFile); + } else { + cacheData = opts.packageCache || b._options && b._options.packageCache; + } // b._options.cache is a shared object into which loaded module cache is merged. // it will be reused for each build, and mutated when the cache is invalidated.