-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
45 lines (43 loc) · 967 Bytes
/
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 path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = {
mode: 'development',
entry: '/src/index.tsx',
output: {
path: path.resolve(__dirname, 'docs'),
filename: 'js/index.js',
clean: true,
},
plugins: [
new HtmlWebpackPlugin({
title: 'Ricemilk1122 Blog since 2023',
favicon: './img/favicon.gif',
template: './src/index.html',
filename: 'index.html',
}),
],
module: {
rules: [
{
test: /\.(ts)x?$/,
use: ['babel-loader'],
exclude: /node_modules/,
},
{
test: /\.less$/,
use: ['style-loader', 'css-loader', 'less-loader'],
},
{
test: /\.(png|jpg|jpeg|gif|svg)$/,
type: 'asset',
generator: {
filename: 'img/[name]_[hash][ext]',
},
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
},
};
module.exports = config;