-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
49 lines (48 loc) · 1.33 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
42
43
44
45
46
47
48
49
require('dotenv').config();
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: './client/app.js',
mode: process.env.MODE,
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'client/dist')
},
module: {
rules: [
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
}
]
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
}),
new webpack.DefinePlugin({
'process.env': {
'LOCAL_NODE': JSON.stringify(process.env.LOCAL_NODE),
'REMOTE_NODE': JSON.stringify(process.env.REMOTE_NODE),
'REMOTE_CONTRACT_ADDRESS': JSON.stringify(process.env.REMOTE_CONTRACT_ADDRESS),
'LOCAL_CONTRACT_ADDRESS': JSON.stringify(process.env.LOCAL_CONTRACT_ADDRESS),
'MODE': JSON.stringify(process.env.MODE),
}
})
],
resolve: {
fallback: {
"url": require.resolve("url/"),
"util": require.resolve("util/"),
"crypto": require.resolve("crypto-browserify"),
"os": require.resolve("os-browserify/browser"),
"https": require.resolve("https-browserify"),
"http": require.resolve("stream-http"),
"stream": require.resolve("stream-browserify")
}
},
externals: [{
xmlhttprequest: '{XMLHttpRequest:XMLHttpRequest}'
}]
};