Skip to content

Commit 3a19f3e

Browse files
committed
핫로딩 실습용
1 parent 9957998 commit 3a19f3e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/scss/variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// TODO: 아래 코드를 수정해 보세요
12
$brand-color: #2ac1bc;
23
$primary-color: blue;
34
$secondary-color: #aaa;

webpack.config.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
44
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
55
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
66

7-
const mode = process.env.NODE_ENV || "development";
8-
97
module.exports = {
10-
mode,
8+
mode: "development",
119
entry: {
1210
main: "./src/app.js"
1311
},
@@ -17,15 +15,18 @@ module.exports = {
1715
},
1816
devServer: {
1917
overlay: true,
20-
stats: "errors-only"
21-
// TODO: 여기에 api 서버 프록싱 설정을 추가하세요
18+
stats: "errors-only",
19+
proxy: {
20+
"/api": "http://localhost:8081"
21+
},
22+
// TODO: 여기에 핫로딩을 설정하세요
2223
},
2324
module: {
2425
rules: [
2526
{
2627
test: /\.(scss|css)$/,
2728
use: [
28-
mode === "production"
29+
process.env.NODE_ENV === "production"
2930
? MiniCssExtractPlugin.loader // 프로덕션 환경
3031
: "style-loader", // 개발 환경
3132
"css-loader",
@@ -55,19 +56,19 @@ module.exports = {
5556
new HtmlWebpackPlugin({
5657
template: "./src/index.html",
5758
templateParameters: {
58-
env: mode === "development" ? "(개발용)" : ""
59+
env: process.env.NODE_ENV === "development" ? "(개발용)" : ""
5960
},
6061
minify:
61-
mode === "production"
62+
process.env.NODE_ENV === "production"
6263
? {
6364
collapseWhitespace: true, // 빈칸 제거
6465
removeComments: true // 주석 제거
6566
}
6667
: false,
67-
hash: mode === "production"
68+
hash: process.env.NODE_ENV === "production"
6869
}),
6970
new CleanWebpackPlugin(),
70-
...(mode === "production"
71+
...(process.env.NODE_ENV === "production"
7172
? [new MiniCssExtractPlugin({ filename: `[name].css` })]
7273
: [])
7374
]

0 commit comments

Comments
 (0)