-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwebpack.config.js
71 lines (68 loc) · 1.86 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
64
65
66
67
68
69
70
71
const path = require('path');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
const { merge } = require('webpack-merge');
const baseConfig = {
mode: 'production',
entry: './src/index.ts',
output: {
library: {
type: 'commonjs',
},
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
mainFiles: ['index.ts', 'index.js'],
extensions: ['.ts', '.js'],
},
externals: {
'@ew-did-registry/did': '@ew-did-registry/did',
'@ew-did-registry/keys': '@ew-did-registry/keys',
'@ew-did-registry/jwt': '@ew-did-registry/jwt',
'@ew-did-registry/did-ethr-resolver': '@ew-did-registry/did-ethr-resolver',
'@ew-did-registry/did-resolver-interface':
'@ew-did-registry/did-resolver-interface',
'@ew-did-registry/did-ipfs-store': '@ew-did-registry/did-ipfs-store',
'@ew-did-registry/did-store-interface':
'@ew-did-registry/did-store-interface',
'@ew-did-registry/did-document': '@ew-did-registry/did-document',
'@ew-did-registry/claims': '@ew-did-registry/claims',
'@ew-did-registry/proxyidentity': '@ew-did-registry/did-proxyidentity',
'@ew-did-registry/did-registry': '@ew-did-registry/did-registry',
'@ew-did-registry/revocation': '@ew-did-registry/revocation',
ethers: 'ethers',
'ethereumjs-util': 'ethereumjs-util',
},
};
const nodeConfig = merge(baseConfig, {
target: 'node16',
output: {
filename: 'index.js',
},
externals: {
eciesjs: 'eciesjs',
base64url: 'base64url',
sjcl: 'sjcl',
'@types/sjcl': '@types/sjcl',
},
});
const webConfig = merge(baseConfig, {
target: 'web',
output: {
filename: 'index.esm.js',
},
plugins: [new NodePolyfillPlugin()],
resolve: {
fallback: {
fs: false,
},
},
});
module.exports = [webConfig, nodeConfig];