-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.common.js
54 lines (52 loc) · 1.35 KB
/
webpack.common.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
46
47
48
49
50
51
52
53
54
import CopyPlugin from "copy-webpack-plugin";
import path from "path";
import { fileURLToPath } from "url";
import webpack from "webpack";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// TODO: use html template plugin; enable chunk splitting
export default {
entry: {
main: "./client/src/index.js",
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: "",
}),
new CopyPlugin({
patterns: [
{ from: "./client/assets" },
{ from: "./client/maps", to: "maps" },
],
}),
],
module: {
rules: [
{
test: /\.js$/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
cacheDirectory: true,
},
},
},
],
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist/client"),
clean: true,
},
target: ["web", "es5"],
optimization: {
usedExports: true,
},
performance: {
assetFilter(filename) {
return !/\.(map|png|mp3|ogg)$/.test(filename);
},
maxAssetSize: 1 << 20,
maxEntrypointSize: 1 << 20,
},
};