From 6576a8a9463e27f678515b8830e0a0eb3032ab6d Mon Sep 17 00:00:00 2001 From: wanghx Date: Wed, 31 Oct 2018 17:03:50 +0800 Subject: [PATCH 1/3] fix: fixed this of stat method is undefined --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index eca7f73..d83468f 100644 --- a/src/index.js +++ b/src/index.js @@ -41,9 +41,9 @@ function loader(...args) { // this.fs can be undefined // e.g when using the thread-loader // fallback to the fs module - const stat = this.fs ? this.fs.stat : fs.stat; + const _fs = this.fs || fs; const toDepDetails = (dep, mapCallback) => { - stat(dep, (err, stats) => { + _fs.stat(dep, (err, stats) => { if (err) { mapCallback(err); return; @@ -112,9 +112,9 @@ function pitch(remainingRequest, prevRequest, dataInput) { callback(); return; } - const stat = this.fs ? this.fs.stat : fs.stat; + const _fs = this.fs || fs; async.each(cacheData.dependencies.concat(cacheData.contextDependencies), (dep, eachCallback) => { - stat(dep.path, (statErr, stats) => { + _fs.stat(dep.path, (statErr, stats) => { if (statErr) { eachCallback(statErr); return; From 6ba9c6357c7a1ffc748712cac2f9d7612f566bb1 Mon Sep 17 00:00:00 2001 From: wanghx Date: Wed, 31 Oct 2018 17:13:12 +0800 Subject: [PATCH 2/3] f --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index d83468f..b457cd5 100644 --- a/src/index.js +++ b/src/index.js @@ -41,9 +41,9 @@ function loader(...args) { // this.fs can be undefined // e.g when using the thread-loader // fallback to the fs module - const _fs = this.fs || fs; + const tempFs = this.fs || fs; const toDepDetails = (dep, mapCallback) => { - _fs.stat(dep, (err, stats) => { + tempFs.stat(dep, (err, stats) => { if (err) { mapCallback(err); return; @@ -112,9 +112,9 @@ function pitch(remainingRequest, prevRequest, dataInput) { callback(); return; } - const _fs = this.fs || fs; + const tempFs = this.fs || fs; async.each(cacheData.dependencies.concat(cacheData.contextDependencies), (dep, eachCallback) => { - _fs.stat(dep.path, (statErr, stats) => { + tempFs.stat(dep.path, (statErr, stats) => { if (statErr) { eachCallback(statErr); return; From 8805831bb02985c653ca17d8d7a0e650c5ae60e6 Mon Sep 17 00:00:00 2001 From: wanghx Date: Wed, 31 Oct 2018 17:36:22 +0800 Subject: [PATCH 3/3] f --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index b457cd5..a675cad 100644 --- a/src/index.js +++ b/src/index.js @@ -41,9 +41,9 @@ function loader(...args) { // this.fs can be undefined // e.g when using the thread-loader // fallback to the fs module - const tempFs = this.fs || fs; + const FS = this.fs || fs; const toDepDetails = (dep, mapCallback) => { - tempFs.stat(dep, (err, stats) => { + FS.stat(dep, (err, stats) => { if (err) { mapCallback(err); return; @@ -112,9 +112,9 @@ function pitch(remainingRequest, prevRequest, dataInput) { callback(); return; } - const tempFs = this.fs || fs; + const FS = this.fs || fs; async.each(cacheData.dependencies.concat(cacheData.contextDependencies), (dep, eachCallback) => { - tempFs.stat(dep.path, (statErr, stats) => { + FS.stat(dep.path, (statErr, stats) => { if (statErr) { eachCallback(statErr); return;