cache-loader
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.2.4"></a> | ||
## [1.2.4](https://github.com/webpack-contrib/cache-loader/compare/v1.2.3...v1.2.4) (2018-10-31) | ||
### Bug Fixes | ||
* **index:** fallback to `fs` if `this.fs` is `undefined` ([#45](https://github.com/webpack-contrib/cache-loader/issues/45)) ([b84d13e](https://github.com/webpack-contrib/cache-loader/commit/b84d13e)) | ||
<a name="1.2.3"></a> | ||
@@ -7,0 +17,0 @@ ## [1.2.3](https://github.com/webpack-contrib/cache-loader/compare/v1.2.2...v1.2.3) (2018-10-30) |
@@ -40,4 +40,2 @@ 'use strict'; | ||
function loader() { | ||
var _this = this; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -64,5 +62,8 @@ args[_key] = arguments[_key]; | ||
var cache = true; | ||
// this.fs can be undefined | ||
// e.g when using the thread-loader | ||
// fallback to the fs module | ||
var stat = this.fs ? this.fs.stat : fs.stat; | ||
var toDepDetails = function toDepDetails(dep, mapCallback) { | ||
_this.fs.stat(dep, function (err, stats) { | ||
stat(dep, function (err, stats) { | ||
if (err) { | ||
@@ -120,3 +121,3 @@ mapCallback(err); | ||
function pitch(remainingRequest, prevRequest, dataInput) { | ||
var _this2 = this; | ||
var _this = this; | ||
@@ -146,4 +147,5 @@ var options = Object.assign({}, defaults, getOptions(this)); | ||
} | ||
var stat = _this.fs ? _this.fs.stat : fs.stat; | ||
async.each(cacheData.dependencies.concat(cacheData.contextDependencies), function (dep, eachCallback) { | ||
_this2.fs.stat(dep.path, function (statErr, stats) { | ||
stat(dep.path, function (statErr, stats) { | ||
if (statErr) { | ||
@@ -166,6 +168,6 @@ eachCallback(statErr); | ||
cacheData.dependencies.forEach(function (dep) { | ||
return _this2.addDependency(dep.path); | ||
return _this.addDependency(dep.path); | ||
}); | ||
cacheData.contextDependencies.forEach(function (dep) { | ||
return _this2.addContextDependency(dep.path); | ||
return _this.addContextDependency(dep.path); | ||
}); | ||
@@ -172,0 +174,0 @@ callback.apply(undefined, [null].concat(_toConsumableArray(cacheData.result))); |
{ | ||
"name": "cache-loader", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Caches the result of following loaders on disk.", | ||
@@ -5,0 +5,0 @@ "author": "Tobias Koppers @sokra", |
19397
207