-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
executable file
·63 lines (62 loc) · 1.59 KB
/
webpack.config.js
File metadata and controls
executable file
·63 lines (62 loc) · 1.59 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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: ["webpack/hot/dev-server.js", "./src/index.ts"],
devtool: "source-map",
mode: "development",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
publicPath: '/'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
include: /node_modules\/react-dom/,
use: ['react-hot-loader/webpack', 'babel-loader']
},
{
test: /\.(ts|tsx)?$/,
loader: "ts-loader",
exclude: /node_modules/
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
{
test: /\.(png|jpg|jpeg|gif|svg)$/i,
type: "asset/resource",
}
]
},
resolve: {
extensions: ['.ts', '.js', '.json', ".tsx"],
alias: {
'@components': path.resolve(__dirname, "./src/components"),
'@constants': path.resolve(__dirname, "./src/constants"),
'@providers': path.resolve(__dirname, "./src/utils/providers"),
'@api': path.resolve(__dirname, "./src/api"),
'@services': path.resolve(__dirname, "./src/api/services"),
}
},
devServer: {
port: 3001,
open: true,
hot: true,
historyApiFallback: true,
},
watchOptions: {
aggregateTimeout: 200,
poll: 1000,
},
plugins: [new HtmlWebpackPlugin({
template: "public/index.html",
hash: true, // cache busting
filename: '../dist/index.html'
}),
new webpack.HotModuleReplacementPlugin()]
}