-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
64 lines (62 loc) · 1.62 KB
/
webpack.common.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
62
63
64
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: path.resolve(__dirname, './src/index.tsx'),
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'esbuild-loader',
options: {
loader: 'tsx',
target: 'es2015',
},
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
type: 'asset/resource',
},
{
test: /\.md$/,
use: [
{
loader: 'html-loader',
},
{
loader: 'markdown-loader',
},
],
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {
assets: path.resolve(__dirname, './src/assets'),
components: path.resolve(__dirname, './src/components'),
hooks: path.resolve(__dirname, './src/hooks'),
pages: path.resolve(__dirname, './src/pages'),
posts: path.resolve(__dirname, './src/posts'),
styles: path.resolve(__dirname, './src/styles'),
utils: path.resolve(__dirname, './src/utils'),
contexts: path.resolve(__dirname, './src/contexts'),
},
},
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/',
filename: 'bundle.js',
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: './public/index.html',
favicon: './public/favicon.ico',
}),
],
};