-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
30 lines (28 loc) · 1 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
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './src/index.js',
mode: 'development',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
node: {
fs: 'empty',
},
plugins: [
new webpack.DefinePlugin({
DEPLOYED_ADDRESS: JSON.stringify(fs.readFileSync('deployedAddress', 'utf8').replace(/\n|\r/g, '')),
DEPLOYED_ABI: fs.existsSync('deployedABI') && fs.readFileSync('deployedABI', 'utf8'),
DEPLOYED_ADDRESS_TOKENSALES: JSON.stringify(
fs.readFileSync('deployedAddress_TokenSales', 'utf8').replace(/\n|\r/g, ''),
),
DEPLOYED_ABI_TOKENSALES:
fs.existsSync('deployedABI_TokenSales') && fs.readFileSync('deployedABI_TokenSales', 'utf8'),
}),
new CopyWebpackPlugin([{from: './src/index.html', to: 'index.html'}]),
],
devServer: {contentBase: path.join(__dirname, 'dist'), compress: true},
};