-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebpack.config.js
More file actions
70 lines (65 loc) · 1.97 KB
/
Copy pathwebpack.config.js
File metadata and controls
70 lines (65 loc) · 1.97 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
let path = require('path');
const webpack = require('webpack');
// 현재 시간을 가져오는 함수
function getCurrentTime() {
const now = new Date();
return now.toLocaleString();
}
module.exports = {
context: path.resolve(__dirname, 'src/main/react'),
entry: {
login: './login/Login.js', // 로그인
employee: './employee/Employee.js', // 직원
order: './order/Order.js', //주문
customer: './customer/Customer.js',// 고객
product: './product/Product.js', // 직원
price: './price/price.js', // 판매가
myPage: './myPage/myPage.js', // 마이페이지
main: './main/Main.js',
},
devtool: 'sourcemaps',
cache: true,
output: { //파일이 생성되는 경로
path: __dirname,
filename: './src/main/resources/static/bundle/[name].bundle.js'
},
mode: 'none',
module: {
rules: [ {
test: /\.js?$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [ '@babel/preset-env', ["@babel/preset-react", {"runtime": "automatic"}] ]
}
}
}, {
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.m?js/,
resolve: {
fullySpecified: false
}
}
]
},
plugins: [
// fix "process is not defined" error:
new webpack.ProvidePlugin({
process: 'process/browser',
}),
new webpack.DefinePlugin({
BUILD_TIME: JSON.stringify(getCurrentTime()), // 현재 시간을 BUILD_TIME으로 정의
}),
{
apply: (compiler) => {
compiler.hooks.beforeCompile.tap('ShowTimePlugin', () => {
console.log('Webpack Build Time:', getCurrentTime());
});
},
},
],
};