Skip to content

Commit

Permalink
Merge pull request #7823 from flyyang/refactor/define-before-use-class
Browse files Browse the repository at this point in the history
Refactor define before use class
  • Loading branch information
sokra committed Jul 31, 2018
2 parents e4ae646 + 5234abe commit 32fdca2
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions lib/WatchIgnorePlugin.js
Expand Up @@ -7,24 +7,6 @@
const validateOptions = require("schema-utils");
const schema = require("../schemas/plugins/WatchIgnorePlugin.json");

class WatchIgnorePlugin {
constructor(paths) {
validateOptions(schema, paths, "Watch Ignore Plugin");
this.paths = paths;
}

apply(compiler) {
compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => {
compiler.watchFileSystem = new IgnoringWatchFileSystem(
compiler.watchFileSystem,
this.paths
);
});
}
}

module.exports = WatchIgnorePlugin;

class IgnoringWatchFileSystem {
constructor(wfs, paths) {
this.wfs = wfs;
Expand Down Expand Up @@ -98,3 +80,21 @@ class IgnoringWatchFileSystem {
};
}
}

class WatchIgnorePlugin {
constructor(paths) {
validateOptions(schema, paths, "Watch Ignore Plugin");
this.paths = paths;
}

apply(compiler) {
compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => {
compiler.watchFileSystem = new IgnoringWatchFileSystem(
compiler.watchFileSystem,
this.paths
);
});
}
}

module.exports = WatchIgnorePlugin;

0 comments on commit 32fdca2

Please sign in to comment.