-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
55 lines (53 loc) · 1.55 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
// for resolving the absolute path to our project
// necessary for webpack
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CompressionPlugin = require("compression-webpack-plugin");
module.exports = {
mode: 'development',
// where our app "starts"
entry: {
index: './js/main.js',
info: './js/restaurant_info.js'
},
// where to put the transpiled javascript
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name]_bundle.js'
},
plugins: [
new UglifyJsPlugin(),
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8
})
],
// babel config
module: {
rules: [
{
// anything file that ends with '.js'
test: /\.js$/,
// except those in "node_modules"
exclude: /node_modules/,
// transform with babel
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
},
{
test: /\.css/,
loaders: ['style-loader', 'css-loader'],
include: __dirname + '/css'
}
]
},
// allows us to see how the transpiled js relates to the untranspiled js
devtool: 'source-map'
};