-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
36 lines (34 loc) · 1.4 KB
/
webpack.config.js
File metadata and controls
36 lines (34 loc) · 1.4 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
//파일을 최적화, 코드의 변화가 있을때 마다 감지를 해서 브라우저의 변경사항을 새로고침할 필요 없이 반영을 해줌.
const webpack = require('webpack')
const path = require('path')
const fs = require('fs')
const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
entry: {
index: "./src/index.js",
career: "./src/career.js"
// module: "./src/bmodul.js"
},
mode: 'development',
output: {
filename: "[name].js",
path: path.resolve(__dirname, 'dist'),
publicPath: '/'
},
plugins: [
new webpack.DefinePlugin({
//전역상수 설정, 파일 시스템을 통해 deployedaddress파일을 읽고 안에 있는 contract주소를 전역 상수에 대입.
DEPLOYED_ADDRESS: JSON.stringify(fs.readFileSync('deployedAddress', 'utf8').replace(/\n|\r/g, "")),
DEPLOYED_ABI: fs.existsSync('deployedABI') && fs.readFileSync('deployedABI', 'utf8'),
DEPLOYED_ADDRESS_2: JSON.stringify(fs.readFileSync('2_deployedAddress', 'utf8').replace(/\n|\r/g, "")),
DEPLOYED_ABI_2: fs.existsSync('deployedABI') && fs.readFileSync('2_deployedABI', 'utf8'),
}),
new CopyWebpackPlugin([{ from: "./src/index.html", to: "index.html"}])
],
devServer: {
contentBase: path.join(__dirname, "dist"), compress: true,
inline:true
// host: '0.0.0.0',
// port: 8008
}
}