@@ -2,7 +2,8 @@ import webpack from 'webpack';
2
2
import path from 'path' ;
3
3
import HtmlWebpackPlugin from 'html-webpack-plugin' ;
4
4
import WebpackMd5Hash from 'webpack-md5-hash' ;
5
- import ExtractTextPlugin from 'extract-text-webpack-plugin' ;
5
+ //import ExtractTextPlugin from 'extract-text-webpack-plugin';
6
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin' ;
6
7
//debug: true,
7
8
//noInfo: false,
8
9
@@ -11,14 +12,14 @@ export default {
11
12
resolve : {
12
13
extensions : [ '*' , '.js' , '.jsx' , '.json' ]
13
14
} ,
14
- devtool : 'source-map' ,
15
+ devtool : 'source-map' , //higher quality than 'inline-source-maps'
15
16
entry : {
16
17
vendor : path . resolve ( __dirname , 'src/vendor' ) ,
17
18
main : path . resolve ( __dirname , 'src/index' )
18
19
} ,
19
20
target : 'web' ,
20
21
output : {
21
- path : path . resolve ( __dirname , 'dist' ) ,
22
+ path : path . resolve ( __dirname , 'dist' ) , // new
22
23
publicPath : '/' ,
23
24
filename : '[name].[chunkhash].js'
24
25
} ,
@@ -45,7 +46,8 @@ export default {
45
46
// (separate css and js)
46
47
// Generate an external css file with a hash in the filename
47
48
//new ExtractTextPlugin('[name].[contenthash].css'),
48
- new ExtractTextPlugin ( '[name].[md5:contenthash:hex:20].css' ) ,
49
+ new MiniCssExtractPlugin ( '[name].[md5:contenthash:hex:20].css' ) ,
50
+ //new ExtractTextPlugin('[name].[md5:contenthash:hex:20].css'),
49
51
// Hash the files using MD5 so that their names change when the content changes.
50
52
new WebpackMd5Hash ( ) ,
51
53
@@ -67,7 +69,7 @@ export default {
67
69
removeEmptyAttributes : true ,
68
70
removeStyleLinkTypeAttributes : true ,
69
71
keepClosingSlash : true ,
70
- minifyJS : true ,
72
+ minifyJS : true , // replaces UglifyJSPlugin
71
73
minifyCSS : true ,
72
74
minifyURLs : true
73
75
} ,
@@ -86,11 +88,31 @@ export default {
86
88
] ,
87
89
module : {
88
90
rules : [
89
- { test : / \. j s $ / , exclude : / n o d e _ m o d u l e s / , loaders : [ 'babel-loader' ] } ,
91
+ // { test: /\.js$/, exclude: /node_modules/, loaders: ['babel-loader'] },
92
+ // {
93
+ // test: /\.css$/,
94
+ // loader: ExtractTextPlugin.extract('css-loader?sourceMap')
95
+ // } // extra param is a hint to webpack
90
96
{
91
97
test : / \. c s s $ / ,
92
- loader : ExtractTextPlugin . extract ( 'css-loader?sourceMap' )
93
- } // extra param is a hint to webpack
94
- ]
98
+ use : [
99
+ {
100
+ loader : MiniCssExtractPlugin . loader
101
+ } ,
102
+
103
+ {
104
+ loader : 'css-loader' ,
105
+ options : {
106
+ sourceMap : true ,
107
+ modules : true ,
108
+ localIdentName : '[local]___[hash:base64:5]'
109
+ }
110
+ } ,
111
+
112
+ // {
113
+ // loader: 'postcss-loader'
114
+ // }
115
+ ]
116
+ } ]
95
117
}
96
118
} ;
0 commit comments