-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
44 lines (42 loc) · 1.15 KB
/
webpack.config.js
File metadata and controls
44 lines (42 loc) · 1.15 KB
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
require("dotenv").config();
var path = require("path");
var SRC_DIR = path.join(__dirname, "/client/src");
var DIST_DIR = path.join(__dirname, "/client/dist");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
const CompressionPlugin = require("compression-webpack-plugin");
module.exports = {
entry: `${SRC_DIR}/index.jsx`,
output: {
filename: "bundle.js",
path: DIST_DIR,
},
plugins: [
new CompressionPlugin({
filename: "bundle.js.gz",
algorithm: "gzip",
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8
}),
// new webpack.DefinePlugin({ // <-- key to reducing React's size
// 'process.env': {
// 'NODE_ENV': JSON.stringify('production')
// }
// }),
// new webpack.optimize.DedupePlugin(), //dedupe similar code
// new webpack.optimize.UglifyJsPlugin(), //minify everything
// new webpack.optimize.AggressiveMergingPlugin(),//Merge chunks
// new NodePolyfillPlugin()
],
module: {
rules: [
{
test: /\.jsx?/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
],
},
};