-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
81 lines (76 loc) · 1.83 KB
/
Copy pathwebpack.config.js
File metadata and controls
81 lines (76 loc) · 1.83 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
74
75
76
77
78
79
80
81
// path: NodeJS에서 파일 및 디렉토리 경로 작업을 위한 전역 모듈
const path = require("path");
const HtmlPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const { VueLoaderPlugin } = require("vue-loader");
module.exports = {
resolve: {
extensions: [".js", ".vue"],
alias: {
"~": path.resolve(__dirname, "src"),
assets: path.resolve(__dirname, "src/assets"),
},
},
// 파일을 읽어들이기 시작하는 진입점 설정
entry: "./src/main.js",
// 결과물(번들)을 반환하는 설정
output: {
// 주석은 기본값!, `__dirname`은 현재 파일의 위치를 알려주는 NodeJS 전역 변수
// path: path.resolve(__dirname, 'dist'),
// filename: 'main.js',
clean: true,
},
// 모듈 처리 방식을 설정
module: {
rules: [
{
test: /\.vue$/,
use: ["vue-loader"],
},
{
test: /\.s?css$/,
use: [
// 순서 중요!
"vue-style-loader",
"style-loader",
"css-loader",
"postcss-loader",
"sass-loader",
],
},
{
test: /\.js$/,
exclude: /node_modules/, // 제외할 경로
use: ["babel-loader"],
},
{
test: /\.(png|jpe?g|gif|webp)$/,
use: "file-loader",
},
{
test: /\.svg$/,
use: [
{
loader: 'file-loader',
}
]
}
],
},
// 번들링 후 결과물의 처리 방식 등 다양한 플러그인들을 설정
plugins: [
new HtmlPlugin({
template: "./index.html",
}),
new CopyPlugin({
patterns: [{ from: "static" }],
}),
new VueLoaderPlugin(),
],
// 개발 서버 옵션
devServer: {
host: '0.0.0.0',
port: 8080,
hot: true,
},
};