Skip to content

Commit

Permalink
Refactor define before use class
Browse files Browse the repository at this point in the history
  • Loading branch information
flyyang committed Jul 31, 2018
1 parent 61ce434 commit 5234abe
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 5234abe

Please sign in to comment.