forked from torusresearch/torus.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
43 lines (39 loc) · 967 Bytes
/
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
const path = require("path");
const webpack = require("webpack");
const nodeExternals = require("webpack-node-externals");
const pkg = require("./package.json");
const pkgName = "torusUtils";
exports.baseConfig = {
resolve: {
alias: {
"bn.js": path.resolve(__dirname, "node_modules/bn.js"),
lodash: path.resolve(__dirname, "node_modules/lodash"),
"js-sha3": path.resolve(__dirname, "node_modules/js-sha3"),
},
},
};
exports.nodeConfig = {
optimization: {
minimize: false,
},
output: {
filename: `${pkgName}-node.js`,
library: {
type: "commonjs2",
},
},
externals: [
nodeExternals({
allowlist: "@toruslabs/http-helpers",
}),
"node-fetch",
...Object.keys(pkg.dependencies).filter((x) => !["@toruslabs/http-helpers"].includes(x)),
/^(@babel\/runtime)/i,
],
target: "node",
plugins: [
new webpack.ProvidePlugin({
fetch: ["node-fetch", "default"],
}),
],
};