-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
60 lines (56 loc) · 1.46 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import * as path from "path";
import {fileURLToPath} from "url";
import CopyPlugin from "copy-webpack-plugin";
import webpack from "webpack";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default env => {
const mode = env.MODE === "development" ? "development" : "production";
return {
stats: "minimal",
mode: mode,
entry: "./src/frontend/main.ts",
devtool: "inline-source-map",
module: {
rules: [
{
test: /\.tsx?$/, use: "ts-loader", exclude: /node_modules/,
}
]
},
resolve: {
extensions: [".js", ".ts", ".tsx"]
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist/backend/public"),
},
plugins: [
new CopyPlugin({
patterns: [
{
from: "./src/frontend", globOptions: {
ignore: ["**/*.js", "**/*.ts", "**/*.tsx"],
}
},
],
}),
// Defining mode: production | development (above) will automatically set
// process.env.NODE_ENV (but let's set explicitly, so we don't need to
// bring in nodejs support).
new webpack.DefinePlugin({
MODE: JSON.stringify(mode),
PONGHOST: JSON.stringify(env.PONGHOST),
}),
],
experiments: {
topLevelAwait: true,
},
devServer: {
client: {
reconnect: false,
// webSocketURL: "ws://0.0.0.0:8081",
},
},
};
}