forked from ethereumjs/ethereumjs-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
63 lines (62 loc) · 1.76 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const { resolve } = require('path')
const { ProvidePlugin } = require('webpack')
module.exports = {
mode: 'production',
entry: './dist.browser/browser/index.js',
plugins: [
new ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new ProvidePlugin({
process: 'process/browser',
}),
],
module: {
rules: [
{
test: /\.js$/,
loader: 'file-replace-loader',
options: {
condition: 'always',
replacement(resourcePath) {
const mapping = {
[resolve('./dist.browser/lib/logging.js')]: resolve(
'./dist.browser/browser/logging.js'
),
[resolve('./dist.browser/lib/net/peer/libp2pnode.js')]: resolve(
'./dist.browser/browser/libp2pnode.js'
),
}
return mapping[resourcePath]
},
async: true,
},
},
],
},
resolve: {
extensions: ['.js'],
},
output: {
filename: 'bundle.js',
path: resolve(__dirname, 'dist'),
library: 'ethereumjs',
},
resolve: {
fallback: {
buffer: require.resolve('buffer'),
constants: require.resolve("constants-browserify"),
crypto: require.resolve('crypto-browserify'), // used by: rlpxpeer, bin/cli.ts
dgram: false, // used by: rlpxpeer via @ethereumjs/devp2p
fs: false, // used by: FullSynchronizer via @ethereumjs/vm
net: false, // used by: rlpxpeer
os: require.resolve('os-browserify/browser'), // used by: bin/cli.ts, web3_clientVersion rpc
path: false, // used by: bin/cli.ts
stream: require.resolve('stream-browserify'), // used by: fetcher
},
},
performance: {
hints: false, // suppress maxAssetSize warnings etc..
},
externals: ['dns'],
}