forked from bcoin-org/bcash
-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.compat.js
40 lines (38 loc) · 907 Bytes
/
webpack.compat.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
'use strict';
const Path = require('path');
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const str = JSON.stringify;
const env = process.env;
module.exports = {
target: 'web',
entry: {
'bcash': './lib/bcash',
'bcash-worker': './lib/workers/worker'
},
output: {
library: 'bcash',
libraryTarget: 'umd',
path: Path.join(__dirname, 'browser'),
filename: '[name].js'
},
resolve: {
modules: ['node_modules'],
extensions: ['-compat.js', '-browser.js', '.js', '.json']
},
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader'
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env.BCASH_NETWORK':
str(env.BCASH_NETWORK || 'main'),
'process.env.BCASH_WORKER_FILE':
str(env.BCASH_WORKER_FILE || '/bcash-worker.js')
}),
new UglifyJsPlugin()
]
};