unused-files-webpack-plugin
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="3.0.1"></a> | ||
## [3.0.1](https://github.com/tomchentw/unused-files-webpack-plugin/compare/v3.0.0...v3.0.1) (2017-02-13) | ||
### Bug Fixes | ||
* **index.js:** prevent freeze when using dev server without bail ([#12](https://github.com/tomchentw/unused-files-webpack-plugin/issues/12)) ([b397e8d](https://github.com/tomchentw/unused-files-webpack-plugin/commit/b397e8d)) | ||
<a name="3.0.0"></a> | ||
@@ -7,0 +17,0 @@ # [3.0.0](https://github.com/tomchentw/unused-files-webpack-plugin/compare/v2.0.5...v3.0.0) (2016-09-22) |
@@ -46,6 +46,5 @@ "use strict"; | ||
var _warnings = _slicedToArray(warnings, 1); | ||
var _warnings = _slicedToArray(warnings, 1), | ||
unusedFilesError = _warnings[0]; | ||
var unusedFilesError = _warnings[0]; | ||
t.equal(unusedFilesError instanceof Error, true); | ||
@@ -52,0 +51,0 @@ |
@@ -26,3 +26,3 @@ "use strict"; | ||
function UnusedFilesWebpackPlugin() { | ||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -61,9 +61,11 @@ _classCallCheck(this, UnusedFilesWebpackPlugin); | ||
}; | ||
var errorArray = this.options.failOnUnused ? compilation.errors : compilation.warnings; | ||
var handleError = function handleError(err) { | ||
if (compilation.bail) { | ||
done(err); | ||
} else { | ||
compilation.errors.push(err); | ||
if (_this2.options.failOnUnused && compilation.bail) { | ||
return done(err); | ||
} | ||
errorArray.push(err); | ||
return done(); | ||
}; | ||
@@ -73,4 +75,3 @@ | ||
if (err) { | ||
handleError(err); | ||
return; | ||
return handleError(err); | ||
} | ||
@@ -81,13 +82,7 @@ var unused = files.filter(function (filepath) { | ||
if (unused.length === 0) { | ||
done(); | ||
return; | ||
return done(); | ||
} | ||
var error = new Error("\nUnusedFilesWebpackPlugin found some unused files:\n" + unused.join("\n")); | ||
if (_this2.options.failOnUnused) { | ||
handleError(error); | ||
} else { | ||
compilation.warnings.push(error); | ||
done(); | ||
} | ||
return handleError(error); | ||
}); | ||
@@ -94,0 +89,0 @@ } |
{ | ||
"name": "unused-files-webpack-plugin", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Glob all files that are not compiled by webpack under webpack's context", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -33,9 +33,13 @@ import { | ||
const absolutePathResolver = it => joinPath(globOptions.cwd, it); | ||
const errorArray = this.options.failOnUnused ? | ||
compilation.errors : | ||
compilation.warnings; | ||
const handleError = err => { | ||
if (compilation.bail) { | ||
done(err); | ||
} else { | ||
compilation.errors.push(err); | ||
if (this.options.failOnUnused && compilation.bail) { | ||
return done(err); | ||
} | ||
errorArray.push(err); | ||
return done(); | ||
}; | ||
@@ -45,4 +49,3 @@ | ||
if (err) { | ||
handleError(err); | ||
return; | ||
return handleError(err); | ||
} | ||
@@ -53,4 +56,3 @@ const unused = files.filter(filepath => | ||
if (unused.length === 0) { | ||
done(); | ||
return; | ||
return done(); | ||
} | ||
@@ -61,8 +63,3 @@ const error = new Error(` | ||
if (this.options.failOnUnused) { | ||
handleError(error); | ||
} else { | ||
compilation.warnings.push(error); | ||
done(); | ||
} | ||
return handleError(error); | ||
}); | ||
@@ -69,0 +66,0 @@ } |
21740
249