-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.js
45 lines (44 loc) · 1.01 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
const path = require("path");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
module.exports = {
// devtool: "inline-source-map",
context: path.join(__dirname, "/client"),
entry: "./index.jsx",
output: {
path: path.join(__dirname, "/public"),
filename: '[name].js',
publicPath: "/public",
},
mode: "development",
// watch: true, //Bundle on saved changes
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader",
query: {
presets: ["es2015", "react", "stage-2"],
},
},
{
test: /\.css$/,
exclude: /node_modules/,
loaders: ["style-loader", "css-loader"],
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
chunks: 'initial',
name: 'vendor',
test: module => /node_modules/.test(module.resource),
enforce: true,
},
},
},
minimizer: [new UglifyJsPlugin()],
},
};