-
Notifications
You must be signed in to change notification settings - Fork 56
/
webpack.config.js
58 lines (51 loc) · 1.27 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
const path = require("path");
const plugins = require("./webpack.plugins");
const isProduction = process.env.NODE_ENV === "production";
module.exports = {
plugins,
mode: process.env.NODE_ENV || "development",
entry: path.resolve(__dirname, "src", "index.tsx"),
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].[hash].js",
chunkFilename: "[name].[hash].js",
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
loader: "ts-loader",
exclude: /node_modules/,
options: {
transpileOnly: true,
},
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
],
},
resolve: {
alias: {
components: path.resolve(__dirname, "src", "components"),
constants: path.resolve(__dirname, "src", "constants"),
store: path.resolve(__dirname, "src", "store"),
utils: path.resolve(__dirname, "src", "utils"),
},
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
devtool: isProduction ? "none" : "eval-cheap-module-source-map",
devServer: {
contentBase: path.resolve(__dirname, "dist"),
compress: true,
port: 1234,
open: true,
host: "0.0.0.0",
},
optimization: {
splitChunks: {
chunks: "all",
},
},
};