-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
45 lines (44 loc) · 1.28 KB
/
webpack.config.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
const fs = require('fs')
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.tsx', // Update the entry point to src/index.ts
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.(ts|tsx)$/, // Add a rule to handle TypeScript files
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.html$/, // Add a rule to handle HTML files
use: 'html-loader',
},
{
test: /\.css$/,
include: path.resolve(__dirname),
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
],
noParse: [/jest\.config\.js/],
},
resolve: {
extensions: ['.ts', '.js', '.tsx'], // Add TypeScript file extension to resolve
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html', // Update the template path to src/index.html
}),
],
devServer: {
hot: false,
liveReload: true,
watchFiles: ['src/**/*'],
host: 'localhost',
port: 8081,
},
};