Skip to content

Commit 1a536a0

Browse files
Chris JimenezSpaceK33z
Chris Jimenez
authored andcommitted
Set default reporter, log, and warn (#131)
options.warn is called before a default is set if options.watchDelay is a thing.
1 parent c3d0ee5 commit 1a536a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

middleware.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ var defaultReporter = function(reporterOptions) {
3737
module.exports = function(compiler, options) {
3838
if(!options) options = {};
3939
if(typeof options.watchOptions === "undefined") options.watchOptions = {};
40+
if(typeof options.reporter !== "function") options.reporter = defaultReporter;
41+
if(typeof options.log !== "function") options.log = console.log.bind(console);
42+
if(typeof options.warn !== "function") options.warn = console.warn.bind(console);
4043
if(typeof options.watchDelay !== "undefined") {
4144
// TODO remove this in next major version
4245
options.warn("options.watchDelay is deprecated: Use 'options.watchOptions.aggregateTimeout' instead");
@@ -53,9 +56,6 @@ module.exports = function(compiler, options) {
5356
options.filename = new RegExp("^[\/]{0,1}" + str + "$");
5457
}
5558
}
56-
if(typeof options.reporter !== "function") options.reporter = defaultReporter;
57-
if(typeof options.log !== "function") options.log = console.log.bind(console);
58-
if(typeof options.warn !== "function") options.warn = console.warn.bind(console);
5959
if(typeof compiler.outputPath === "string" && !path.isAbsolute(compiler.outputPath)) {
6060
throw new Error("`output.path` needs to be an absolute path or `/`.");
6161
}

0 commit comments

Comments
 (0)