Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

Commit 5c67ccd

Browse files
whxaxesmichael-ciniawsky
authored andcommitted
fix(index): this of stat method is undefined (#47)
1 parent 97be0c1 commit 5c67ccd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function loader(...args) {
4141
// this.fs can be undefined
4242
// e.g when using the thread-loader
4343
// fallback to the fs module
44-
const stat = this.fs ? this.fs.stat : fs.stat;
44+
const FS = this.fs || fs;
4545
const toDepDetails = (dep, mapCallback) => {
46-
stat(dep, (err, stats) => {
46+
FS.stat(dep, (err, stats) => {
4747
if (err) {
4848
mapCallback(err);
4949
return;
@@ -112,9 +112,9 @@ function pitch(remainingRequest, prevRequest, dataInput) {
112112
callback();
113113
return;
114114
}
115-
const stat = this.fs ? this.fs.stat : fs.stat;
115+
const FS = this.fs || fs;
116116
async.each(cacheData.dependencies.concat(cacheData.contextDependencies), (dep, eachCallback) => {
117-
stat(dep.path, (statErr, stats) => {
117+
FS.stat(dep.path, (statErr, stats) => {
118118
if (statErr) {
119119
eachCallback(statErr);
120120
return;

0 commit comments

Comments
 (0)