-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.mjs
More file actions
48 lines (47 loc) · 1005 Bytes
/
webpack.config.mjs
File metadata and controls
48 lines (47 loc) · 1005 Bytes
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
import path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
export default {
entry: './src/index.tsx', // Adjust the entry point if needed
output: {
path: path.resolve(process.cwd(), 'dist'),
filename: 'bundle.js',
clean: true
},
mode: process.env.NODE_ENV || 'development',
devtool: 'source-map',
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: 'ts-loader'
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpg|gif|svg)$/,
type: 'asset/resource'
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
favicon: './public/favicon.ico'
})
],
devServer: {
static: {
directory: path.join(process.cwd(), 'public')
},
compress: true,
port: 3000,
open: true,
hot: true
}
};