-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
41 lines (40 loc) · 1.36 KB
/
webpack.config.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
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
module.exports = {
devtool: 'eval-source-map',
//엔트리와 output을 명시한다.
//https://stackoverflow.com/questions/42813050/webpack-multiple-entry-points-sass-and-js
entry: ['./src/index.ts', './style/style.scss'],
module: {
//test는 로더를 적용할 파일 형식으로 일반적으로 정규 표현식 사용한다.
rules: [{
test: /\.ts$/,
use: 'ts-loader',
include: [path.resolve(__dirname, 'src')] //타겟 대상은 어디에 있는가..
},
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader,'css-loader', 'sass-loader'],
include: [path.resolve(__dirname, 'style')]
},
{
test: /\.(png|jpg|gif)$/i,
loader: 'file-loader',
options:{
name : 'public[contenthash].[ext]',
}
},
]
},
resolve: {
extensions: ['.ts', '.js']
},
output: {
publicPath: 'public',
filename: 'bundle.js',
path: path.resolve(__dirname, 'public')
},
plugins: [
new MiniCssExtractPlugin({ filename: 'style.css' })
]
}