@@ -3,8 +3,11 @@ var webpack = require('webpack')
3
3
const FriendlyErrorsWebpackPlugin = require ( 'friendly-errors-webpack-plugin' )
4
4
const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
5
5
const StylelintPlugin = require ( 'stylelint-webpack-plugin' )
6
+ const UglifyJsPlugin = require ( 'uglifyjs-webpack-plugin' )
7
+ const MiniCssExtractPlugin = require ( 'mini-css-extract-plugin' )
6
8
7
9
module . exports = {
10
+ mode :'production' ,
8
11
entry :'./components/index.js' ,
9
12
output :{
10
13
path :path . resolve ( __dirname , '../dist' ) ,
@@ -19,6 +22,13 @@ module.exports = {
19
22
'public' :path . resolve ( __dirname , './public' )
20
23
}
21
24
} ,
25
+ optimization :{
26
+ minimizer :[
27
+ new UglifyJsPlugin ( {
28
+ sourceMap :false
29
+ } )
30
+ ]
31
+ } ,
22
32
module :{
23
33
noParse :/ e s 6 - p r o m i s e \. j s $ / , // avoid webpack shimming process
24
34
rules :[
@@ -49,10 +59,11 @@ module.exports = {
49
59
} ,
50
60
{
51
61
test :/ \. c s s $ / ,
52
- use :ExtractTextPlugin . extract ( {
53
- use :[ 'css-loader' ]
54
- } )
55
- }
62
+ use :[
63
+ MiniCssExtractPlugin . loader ,
64
+ 'css-loader'
65
+ ]
66
+ } ,
56
67
]
57
68
} ,
58
69
devServer :{
@@ -67,7 +78,9 @@ module.exports = {
67
78
new FriendlyErrorsWebpackPlugin ( {
68
79
clearConsole :true
69
80
} ) ,
70
- new ExtractTextPlugin ( 'carvue.min.css' ) ,
81
+ new MiniCssExtractPlugin ( {
82
+ filename :'carvue.min.css'
83
+ } ) ,
71
84
new StylelintPlugin ( {
72
85
files :[ '**/*.vue' ]
73
86
} )
@@ -82,12 +95,6 @@ if (process.env.NODE_ENV === 'production') {
82
95
NODE_ENV :'"production"' ,
83
96
}
84
97
} ) ,
85
- new webpack . optimize . UglifyJsPlugin ( {
86
- sourceMap :true ,
87
- compress :{
88
- warnings :false
89
- }
90
- } ) ,
91
98
new webpack . LoaderOptionsPlugin ( {
92
99
minimize :true
93
100
} )