generated from Jagoda11/react-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.mjs
More file actions
57 lines (55 loc) Β· 1.28 KB
/
webpack.config.mjs
File metadata and controls
57 lines (55 loc) Β· 1.28 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
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import path from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
export default {
mode: 'development',
entry: './src/index.tsx',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/github-insights-dashboard/',
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: {
loader: 'babel-loader',
options: {
plugins: ['react-refresh/babel'],
},
},
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
devServer: {
static: {
directory: path.join(__dirname, 'public'),
},
historyApiFallback: {
index: '/github-insights-dashboard/index.html',
disableDotRule: true,
},
compress: true,
hot: true,
port: 3002,
open: ['/github-insights-dashboard/'],
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
}),
new ReactRefreshWebpackPlugin(),
],
}