-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.dev.js
61 lines (59 loc) · 1.21 KB
/
webpack.config.dev.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
59
60
61
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
devtool: 'inline-source-map',
entry: {
main: './src/index.tsx',
},
output: {
path: path.resolve(__dirname, 'build'),
filename: '[name]-bundle.js',
publicPath: '/',
},
devServer: {
publicPath: '/',
hot: true,
overlay: false,
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader'
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
},
{
test: /\.png?$/,
use: 'file-loader'
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
type: 'asset/resource',
},
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: './public',
filter: async (resourcePath) => {
const filename = resourcePath.split('/').pop();
return filename !== 'index.html';
},
},
],
}),
new HtmlWebpackPlugin({
template: './public/index.html'
}),
],
};