Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
70 lines (67 loc) · 1.93 KB
/
Copy pathwebpack.config.js
File metadata and controls
70 lines (67 loc) · 1.93 KB
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
65
66
67
68
69
70
import path from "node:path";
import { fileURLToPath } from "node:url";
import HtmlWebpackPlugin from "html-webpack-plugin";
import DotEnv from "dotenv-webpack";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const config = {
mode: "development",
entry: "/client_src/main.tsx",
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: "/node_modules/",
},
{
test: /\.s[ac]ss$/i,
use: ["style-loader", "css-loader", "sass-loader"],
},
{
test: /\.(png|jpeg|jpg|svg|webp)$/i,
type: "asset/resource",
},
{
test: /\.json$/i,
type: "module",
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, "index.html"),
favicon: path.join(__dirname, "/client_src/assets/favicon.ico"),
}),
new DotEnv(),
],
devServer: {
compress: true,
historyApiFallback: {
rewrites: [
{
from: /./,
to: "/index.html",
},
],
},
port: 7924,
},
devtool: "inline-source-map",
resolve: {
extensions: [".ts", ".tsx", ".jsx", ".js"],
alias: {
"@components": path.resolve(__dirname, "client_src/components"),
"@styles": path.resolve(__dirname, "client_src/styles"),
"@assets": path.resolve(__dirname, "client_src/assets"),
"@root": path.resolve(__dirname),
"@src": path.resolve(__dirname, "client_src"),
},
},
output: {
filename: "main.bundle.js",
path: path.resolve(__dirname, "client_dist"),
publicPath: "/",
},
};
export default config;