File tree 3 files changed +25
-4
lines changed
3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ module.exports = function (grunt) {
56
56
plugins : require ( "./webpack.config.js" ) . prodPlugins
57
57
} ,
58
58
dev : {
59
- cache : false
59
+ cache : false ,
60
+ plugins : require ( "./webpack.config.js" ) . devPlugins
60
61
}
61
62
} ,
62
63
copy : {
Original file line number Diff line number Diff line change 27
27
"babel-loader" : " ^6.2.10" ,
28
28
"babel-preset-es2015" : " ^6.5.0" ,
29
29
"babelify" : " ^6.1.0" ,
30
+ "clean-webpack-plugin" : " ^0.1.15" ,
30
31
"express" : " ~3.4.8" ,
31
32
"grunt" : " ~0.4.5" ,
32
33
"grunt-contrib-connect" : " ~0.10.1" ,
Original file line number Diff line number Diff line change 1
1
var path = require ( 'path' ) ;
2
2
var webpack = require ( 'webpack' ) ;
3
- var packageJSON = require ( './package.json' ) ;
4
3
5
4
module . exports . config = {
6
5
entry : {
@@ -26,13 +25,33 @@ module.exports.config = {
26
25
}
27
26
} ;
28
27
28
+ /**** plugins ****/
29
+
30
+ var packageJSON = require ( './package.json' ) ;
31
+ var CleanWebpackPlugin = require ( 'clean-webpack-plugin' ) ;
32
+
29
33
var banner =
30
34
packageJSON . name + '\n' +
31
35
packageJSON . homepage + '\n' +
32
36
'Version: ' + packageJSON . version + ' -- ' + ( new Date ( ) ) . toISOString ( ) + '\n' +
33
37
'License: ' + packageJSON . license ;
34
38
35
- module . exports . prodPlugins = [
39
+ var plugins = [
40
+ new CleanWebpackPlugin ( [ 'temp' ] , {
41
+ root : process . cwd ( ) ,
42
+ verbose : true ,
43
+ dry : false ,
44
+ } )
45
+ ] ;
46
+
47
+ module . exports . devPlugins = plugins ;
48
+
49
+ module . exports . prodPlugins = plugins . concat ( [
50
+ new CleanWebpackPlugin ( [ 'temp' ] , {
51
+ root : process . cwd ( ) ,
52
+ verbose : true ,
53
+ dry : false ,
54
+ } ) ,
36
55
new webpack . optimize . UglifyJsPlugin ( {
37
56
compress : {
38
57
warnings : true ,
@@ -42,4 +61,4 @@ module.exports.prodPlugins = [
42
61
} ,
43
62
} ) ,
44
63
new webpack . BannerPlugin ( banner )
45
- ] ;
64
+ ] ) ;
You can’t perform that action at this time.
0 commit comments