-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.development.js
98 lines (97 loc) · 2.28 KB
/
webpack.config.development.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
// const BundleAnalyzerPlugin =
// require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
mode: 'development',
entry: './src/index.tsx',
output: {
filename: '[name].[contenthash].js',
chunkFilename: '[name].[chunkhash].js',
path: path.resolve(__dirname, 'docs_dev'),
publicPath: '/', // 빌드 파일 절대 경로(중첩된 route 문제)
clean: true, // 빌드하기 전에 build 폴더 정리
},
optimization: {
splitChunks: {
chunks: 'all',
cacheGroups: {
default: false,
vendor: false,
framework: {
name: 'framework',
test: /\/node_modules\/(react|react-dom|react-router-dom)\//,
priority: 40,
enforce: true,
}, // core framework
commons: { name: 'commons', test: /\/node_modules\//, priority: 20 }, // 그 외의 모듈에 대한 chunk
},
},
},
resolve: {
modules: ['node_modules', 'src'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
module: {
rules: [
{
test: /\.css$/,
exclude: /node_modules/,
use: {
loader: 'css-loader',
options: {
modules: true,
},
},
},
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
},
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.html$/,
exclude: /node_modules/,
use: {
loader: 'html-loader',
options: {
minimize: true,
},
},
},
{
test: /\.(jpg|png)$/,
use: [
{
loader: 'url-loader',
options: {
esModule: false,
},
},
{
loader: 'img-loader',
},
],
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
publicPath: '/',
template: 'src/index.development.html',
}),
// new BundleAnalyzerPlugin(),
],
devtool: 'source-map',
};