-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
57 lines (52 loc) · 1.29 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
"use strict";
const path = require("path");
const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
const webpack = require("webpack");
const isDevelopment = process.env.NODE_ENV !== "production";
module.exports = (env) => ({
mode: isDevelopment ? "development" : "production",
devtool: "inline-source-map",
entry: "./src/index.tsx",
output: {
filename: "bundle.js",
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
},
{
test: /\.csv$/,
loader: "csv-loader",
options: {
dynamicTyping: true,
header: true,
skipEmptyLines: true,
},
},
],
},
plugins: [
...[
isDevelopment && new webpack.HotModuleReplacementPlugin(),
isDevelopment && new ReactRefreshWebpackPlugin(),
].filter(Boolean),
new webpack.DefinePlugin({
DEVELOPMENT: JSON.stringify(true),
HOST: JSON.stringify(
env.local ? "http://localhost:3000" : "https://crypto-keeper.io"
),
SERVER: JSON.stringify("http://localhost:3001"),
TEST: JSON.stringify(env.foo),
}),
],
resolve: {
extensions: [".ts", ".tsx", ".js", ".csv"],
},
devServer: {
port: 3000,
historyApiFallback: true,
contentBase: "./",
},
});