forked from ChatFlowProject/chatter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
73 lines (72 loc) · 1.93 KB
/
webpack.config.js
File metadata and controls
73 lines (72 loc) · 1.93 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import path from 'path'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import { CleanWebpackPlugin } from 'clean-webpack-plugin'
export default {
mode: 'development', // 'production'으로 변경 가능
entry: './src/main.tsx', // Vite에서는 main.jsx, index.jsx 같은 파일을 entry로 사용함
output: {
filename: 'bundle.js',
publicPath: '/',
},
devServer: {
historyApiFallback: true,
port: 3000,
hot: true,
open: true,
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
alias: {
'@api': path.resolve(process.cwd(), 'src/api'),
'@assets': path.resolve(process.cwd(), 'src/assets'),
'@components': path.resolve(process.cwd(), 'src/components'),
'@hooks': path.resolve(process.cwd(), 'src/hooks'),
'@store': path.resolve(process.cwd(), 'src/store'),
'@types': path.resolve(process.cwd(), 'src/types'),
'@utils': path.resolve(process.cwd(), 'src/utils'),
'@pages': path.resolve(process.cwd(), 'src/pages'),
},
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
['@babel/preset-react', { runtime: 'automatic' }],
'@babel/preset-typescript',
],
},
},
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
},
},
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
{
test: /\.(png|jpe?g|gif|svg)$/,
type: 'asset/resource',
},
],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: './public/index.html',
}),
],
}