Skip to content

Commit 11d43b9

Browse files
committed
chore: webpack 배포 설정 분리
1 parent e2310ae commit 11d43b9

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

config/webpack.prod.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const { merge } = require("webpack-merge");
2+
const common = require("./webpack.common");
3+
const path = require("path");
4+
const TerserPlugin = require("terser-webpack-plugin");
5+
6+
module.exports = merge(common, {
7+
mode: "production",
8+
devtool: "cheap-module-source-map",
9+
output: {
10+
filename: "[name].[contenthash].js",
11+
path: path.resolve(__dirname, "../dist"),
12+
publicPath: "./",
13+
clean: true,
14+
},
15+
optimization: {
16+
usedExports: true,
17+
minimize: true,
18+
minimizer: [
19+
new TerserPlugin({
20+
terserOptions: {
21+
compress: {
22+
drop_console: true,
23+
},
24+
},
25+
}),
26+
],
27+
splitChunks: {
28+
chunks: "all",
29+
},
30+
},
31+
performance: {
32+
hints: false,
33+
maxEntrypointSize: 512000,
34+
maxAssetSize: 512000,
35+
},
36+
});

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
"main": "index.tsx",
66
"scripts": {
77
"dev": "webpack-dev-server --config config/webpack.dev.js",
8-
"build": "webpack --mode production",
9-
"prestart": "npm build",
10-
"start": "webpack --mode development"
8+
"build": "webpack --config config/webpack.prod.js"
119
},
1210
"repository": {
1311
"type": "git",

0 commit comments

Comments
 (0)