-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
42 lines (40 loc) · 1.26 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
const path = require("path");
const isProd = process.env.NODE_ENV === "production";
const webpack = require('webpack');
const CompressionPlugin = require('compression-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
plugins: [
new webpack.HashedModuleIdsPlugin(),
new CompressionPlugin(),
new ManifestPlugin({})
],
entry: {
index: "./lib/js/src/client/Index.js",
game: "./lib/js/src/client/Game.js",
},
mode: isProd ? "production" : "development",
output: {
path: path.join(__dirname, "public/assets"),
filename: isProd ? "[name].[contenthash].js" : "[name].js",
},
optimization: {
minimizer: isProd ? [new UglifyJsPlugin({sourceMap: true})] : [],
runtimeChunk: "single",
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
},
pathData: {
test: /path_data/,
name: 'path_data',
chunks: 'all'
}
}
}
}
};