Javascript SDK of WoopChain protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
sdk/webpack.config.js

67 lines
1.5 KiB

const path = require('path');
const UglifyJs = require('uglifyjs-webpack-plugin');
const packagesSettings = require('./scripts/packagesList');
function createBatchConfig(list) {
return list.map((l) => {
const entryBase = {};
entryBase[l.name] = [`./packages/${l.dest}/dist/index.js`];
const batchBaseConfig = {
entry: entryBase,
mode: 'production',
module: {
rules: [
{
test: /\.js$/,
// use: {
// loader: 'babel-loader',
// },
},
],
},
devtool: 'source-map',
resolve: {
symlinks: true,
extensions: ['.js'],
},
};
const batchClientConfig = {
...batchBaseConfig,
optimization: {
minimizer: [
new UglifyJs({
uglifyOptions: {
compress: true,
mangle: true,
toplevel: false,
output: {
beautify: false,
comments: false,
},
},
parallel: true,
sourceMap: true,
}),
],
},
output: {
libraryTarget: 'umd',
library: `${l.name}`,
filename: '[name].browser.js',
path: path.join(__dirname, 'dist'),
},
};
return [batchBaseConfig, batchClientConfig];
});
}
function reduceDimension(arr) {
return Array.prototype.concat.apply([], arr);
}
const batch = reduceDimension(createBatchConfig(packagesSettings));
module.exports = batch;