-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
56 lines (55 loc) · 1.38 KB
/
webpack.config.js
File metadata and controls
56 lines (55 loc) · 1.38 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
const path = require('path')
const HtmlPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
module.exports = (env, options) => {
console.log(env, options)
return {
resolve: {
extensions: ['.js'],
alias: {
'herop~': path.resolve(__dirname, 'src')
//src라는 폴더경로 별칭 지정
}
},
entry: './src/main.js',
output: {
//path: '',
//filename: '',
publicPath: '/', //경로 설정.
clean: true //dist 폴더를 깨끗하게 정리하고 다시 생성해라.
},
module: {
rules: [
{
test: '/\.js$/', //js확장자를 가진 파일
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.s?css$/,
use:[
'style-loader',
'css-loader',
'postcss-loader', //후처리
'sass-loader'
]
}
]
},
plugins:[
new HtmlPlugin({
template: './src/index.html'
}),
new CopyPlugin({
patterns:[
{ from: 'static' },
]
})
],
devServer: {
//port: 8080, 기본값
// open: true,true는 자동으로 브라우저 열림. 기본값
//historyApiFallback: true <--- 윈도우에 history객체를 통해서 라우터에 히스토리 모드를 켤때 필요
}
}
}