File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module.exports = {
19
19
exclude : [ '*.test.js' ] ,
20
20
// Root directory (optional)
21
21
root : __dirname ,
22
- failOnUnused : true
22
+ failOnUnused : true ,
23
23
} ) ,
24
24
] ,
25
25
} ;
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ function UnusedPlugin(options) {
10
10
}
11
11
12
12
UnusedPlugin . prototype . apply = function ( compiler ) {
13
- compiler . plugin (
14
- 'emit ' ,
13
+ compiler . hooks . emit . tapAsync (
14
+ 'UnusedPlugin ' ,
15
15
function ( compilation , callback ) {
16
16
// Files used by Webpack during compilation
17
17
const usedModules = Array . from ( compilation . fileDependencies )
@@ -44,9 +44,9 @@ module.exports = UnusedPlugin;
44
44
function continueOrFail ( failOnUnused , compilation , allFiles ) {
45
45
if ( allFiles && allFiles . length > 0 ) {
46
46
if ( failOnUnused ) {
47
- compilation . errors . push ( new Error ( " Unused files found" ) ) ;
47
+ compilation . errors . push ( new Error ( ' Unused files found' ) ) ;
48
48
} else {
49
- compilation . warnings . push ( new Error ( " Unused files found" ) ) ;
49
+ compilation . warnings . push ( new Error ( ' Unused files found' ) ) ;
50
50
}
51
51
}
52
52
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " unused-webpack-plugin" ,
3
- "version" : " 1.2 .0" ,
3
+ "version" : " 2.0 .0" ,
4
4
"description" : " A webpack plugin to find unused modules/source files" ,
5
5
"main" : " index.js" ,
6
6
"repository" : " https://github.com/MatthieuLemoine/unused-webpack-plugin" ,
7
7
"author" : " MatthieuLemoine" ,
8
8
"license" : " MIT" ,
9
9
"scripts" : {
10
- "pretty" :
11
- " prettier-eslint --single-quote --trailing-comma es5 --write \" **/*.js\" \" **/*.json\" " ,
10
+ "pretty" : " prettier-eslint --single-quote --trailing-comma es5 --write \" **/*.js\" \" **/*.json\" " ,
12
11
"lint" : " eslint index.js"
13
12
},
14
13
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments