-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
33 lines (31 loc) · 994 Bytes
/
webpack.prod.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
const path = require("path");
const webpack = require("webpack");
const { merge } = require("webpack-merge");
const common = require("./webpack.common.js");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const ENTRY = {
/** Bundle for development purposes */
"public": "./src/index.js",
/** Bundle for distribution */
"dist/public": "./src/index.js",
};
module.exports = merge(common, {
mode: "production",
entry: ENTRY,
output: {
path: path.resolve(__dirname, "./"),
publicPath: "/assets/",
filename: "[name]/bundle.js",
},
plugins: [
/** Ignore the react-hot-loader dependency */
new webpack.IgnorePlugin(/react-hot-loader/),
/** Copy files from public directory to dist directory */
new CopyWebpackPlugin({
patterns: [{
from: path.join(__dirname, "./public"),
to: path.join(__dirname, "./dist/public"),
}],
}),
],
});