-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
64 lines (60 loc) · 1.36 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
60
61
62
63
64
const path = require("path");
let config;
try {
config = require("./config/config.json");
} catch {
console.error("config/config.json not found! Have you run 'yarn setup'?");
process.exit(1);
}
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
module.exports = {
mode: "development",
entry: path.resolve(__dirname, "src", "client"),
output: {
path: path.resolve(__dirname, "dist/client"),
filename: "bundle.js",
publicPath: "/",
},
resolve: {
extensions: [".js", ".jsx", ".tsx", ".ts"],
modules: [
path.resolve(__dirname, "src", "client"),
path.resolve(__dirname, "node_modules"),
],
plugins: [new TsconfigPathsPlugin({ configFile: "tsconfig.client.json" })],
},
devServer: {
historyApiFallback: true,
proxy:
process.env.NODE_ENV == "production"
? null
: {
"/api": {
target: `http://localhost:${config.port}`,
secure: false,
},
},
},
module: {
rules: [
{
test: /\.jsx?/,
loader: "babel-loader",
},
{
test: /\.(ts|tsx)?$/,
use: {
loader: "ts-loader",
},
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.svg$/,
loader: "svg-inline-loader",
},
],
},
};