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

fix(index): this of stat method is undefined #47

Merged
merged 3 commits into from
Oct 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down