Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
585 changes: 328 additions & 257 deletions dist/ethjs-util.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethjs-util.js.map

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions dist/ethjs-util.min.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions dist/ethjs-util.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
77 changes: 38 additions & 39 deletions internals/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');

var env = process.env.NODE_ENV; // eslint-disable-line
var filename = 'ethjs-util'; // eslint-disable-line
var library = 'ethUtil'; // eslint-disable-line
var config = { // eslint-disable-line
// TODO: temporary workaround for making webpack 4 work across Node.js versions
// Remove once project upgraded to webpack 5
// https://stackoverflow.com/questions/69394632/webpack-build-failing-with-err-ossl-evp-unsupported/69691525#69691525
const crypto = require('crypto');

const cryptoOrigCreateHash = crypto.createHash;
crypto.createHash = (algorithm) => cryptoOrigCreateHash(algorithm === 'md4' ? 'sha256' : algorithm);

const env = process.env.NODE_ENV;
const filename = 'ethjs-util';
const library = 'ethUtil';
const config = {
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: /node_modules/,
},
{
test: /\.json$/,
loader: ['json-loader'],
},
],
},
devtool: 'cheap-module-source-map',
devtool: env === 'production'
? false
: 'cheap-module-source-map',
optimization: env === 'production'
? {
minimize: true,
minimizer: [new TerserPlugin({
sourceMap: false,
terserOptions: {
ecma: 6,
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
},
ie8: false,
mangle: false,
},
})],
} : {},
output: {
path: path.resolve(path.join(__dirname, '../../dist')),
filename: filename + '.js', // eslint-disable-line
library: library, // eslint-disable-line
filename: env === 'production'
? filename + '.min.js' // eslint-disable-line
: filename + '.js', // eslint-disable-line
library,
libraryTarget: 'umd',
umdNamedDefine: true,
},
plugins: [
new webpack.BannerPlugin({ banner: ' /* eslint-disable */ ', raw: true, entryOnly: true }),
new webpack.BannerPlugin({ banner: '/* eslint-disable */', raw: true, entryOnly: true }),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(env),
}),
],
};

if (env === 'production') {
config.output.filename = filename + '.min.js'; // eslint-disable-line
config.plugins
.push(new webpack.optimize.UglifyJsPlugin({
compressor: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
screw_ie8: false,
},
mangle: {
screw_ie8: false,
},
output: {
screw_ie8: false,
},
}));
}

module.exports = config;
Loading