chore(types): add type support for WarnNoModeSetPlugin and Warning

This commit is contained in:
Sean Larkin 2018-08-08 11:31:47 -07:00
parent 7dc00dbc09
commit 94499787f8
No known key found for this signature in database
GPG Key ID: B24730E407776925
2 changed files with 16 additions and 2 deletions

View File

@ -6,7 +6,13 @@
const WebpackError = require("./WebpackError");
module.exports = class NoModeWarning extends WebpackError {
/** @typedef {import("./Module")} Module */
class NoModeWarning extends WebpackError {
/**
* @param {Module[]=} modules modules used
*/
// TODO: Do we need this modules argument from constructor if its not used?
constructor(modules) {
super();
@ -20,4 +26,6 @@ module.exports = class NoModeWarning extends WebpackError {
Error.captureStackTrace(this, this.constructor);
}
};
}
module.exports = NoModeWarning;

View File

@ -6,7 +6,13 @@
const NoModeWarning = require("./NoModeWarning");
/** @typedef {import("./Compiler")} Compiler */
class WarnNoModeSetPlugin {
/**
* @param {Compiler} compiler webpack compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.thisCompilation.tap("WarnNoModeSetPlugin", compilation => {
compilation.warnings.push(new NoModeWarning());