-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
55 lines (53 loc) · 1.71 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
const path = require('path')
const R = require('ramda')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
function configure(filename, opts = {}) {
return (env, argv) => R.mergeDeepRight({
entry: './src/index.js',
mode: 'development', // automatically overriden by production flag
devtool: argv.mode === 'production' ? 'source-map' : 'eval-source-map',
node: {
fs: 'empty',
__dirname: false
},
module: {
rules: [{
test: /\.js$/,
include: path.resolve(__dirname, 'es'),
loader: 'babel-loader'
},
{
test: /\.js$/,
include: path.resolve(__dirname, 'node_modules/rlp'),
loader: 'babel-loader',
options: { presets: ['@babel/preset-env'] }
}
]
},
plugins: argv.report ? [
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: filename + '.html',
openAnalyzer: false
})
] : [],
output: {
path: path.resolve(__dirname, 'dist'),
filename,
library: 'Ae',
libraryTarget: 'umd'
},
externals: Object
.keys(require('./package').dependencies)
.reduce((p, dependency) => ({
...p,
[dependency]: {
commonjs: dependency,
commonjs2: dependency
}
}), {})
}, opts)
}
module.exports = [
configure('hid-hd-wallet.js', { target: 'node' }),
]