-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
74 lines (71 loc) · 1.65 KB
/
Copy pathwebpack.config.js
File metadata and controls
74 lines (71 loc) · 1.65 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const TerserPlugin = require("terser-webpack-plugin");
const { execSync } = require("child_process");
let commitHash = execSync('git rev-parse HEAD').toString().trim();
const webpack = require("webpack"),
path = require("path"),
srcPath = path.join(__dirname, "src");
module.exports = {
target: "web",
cache: true,
devtool: "source-map",
mode: "production",
devServer: {
contentBase: path.join(__dirname, "public"),
publicPath: "/"
},
entry: {
app: path.join(srcPath, "app.js"),
server: "webpack/hot/dev-server",
devServer: `${require.resolve("webpack-dev-server/client") }?http://localhost:8082/`,
},
resolve: {
modules: [srcPath, "node_modules"],
extensions: [".js", ".jsx", ".json"]
},
output: {
path: path.join(__dirname, "build"),
publicPath: "/",
filename: "[name].js",
chunkFilename: "[name].js",
pathinfo: true
},
performance: {
hints: false
},
module: {
rules: [
{
test: /\.js(|x)?$/,
exclude: /node_modules|thirdParty/,
use: [{
loader: "babel-loader"
}],
},
{
test: /\.worker\.js$/,
loader: "worker-loader",
options: { inline: true }
}
]
},
optimization: {
minimizer: [new TerserPlugin({
terserOptions: {
output: {
comments: false,
},
},
extractComments: false
})]
},
plugins: [
new webpack.DefinePlugin({
__COMMIT_HASH__: JSON.stringify(commitHash)
}),
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/
}),
new webpack.HotModuleReplacementPlugin()
]
};