-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
67 lines (65 loc) · 1.89 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const extractSass = new ExtractTextPlugin({
filename : 'bundle.css'
});
module.exports = {
entry : './app/index.js',
devtool : 'source-map',
devServer : {
port : 3000,
compress : true,
watchOptions : {
aggregateTimeout : 300,
poll : 1000
}
},
module : {
rules : [
{
test : /\.js$/,
exclude : /node_modules/,
loader : 'babel-loader'
},
{
test : /\.scss$/,
use : extractSass.extract({
use : [{
loader : 'css-loader', options : {
sourceMap : true
}
},
'postcss-loader',
{
loader : 'sass-loader', options : {
sourceMap : true
}
}],
// use style-loader in development
fallback : 'style-loader'
})
}
]
},
output : {
filename : 'bundle.js',
path : path.resolve(__dirname, 'build'),
publicPath : '/build'
},
plugins : [
extractSass,
new CopyWebpackPlugin([
{ from : 'app/images', to : 'images', ignore : ['.DS_Store'] },
{ from : 'index.html', to : 'index.html' },
]),
new CompressionPlugin({
asset : "[path].gz[query]",
algorithm : "gzip",
test : /\.(js|html)$/,
threshold : 10240,
minRatio : 0.8
})
]
};