<commit_before>const { resolve } = require('path');
const { optimize, BannerPlugin } = require('webpack');
const CompressionWebpackPlugin = require('compression-webpack-plugin');
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const pirateFlag = require('pirate-flag');
const moment = require('moment');
const pkg = require('./package.json');

const git = new GitRevisionPlugin({ lightweightTags: true });

moment.locale();

module.exports = (argv = {}) => ({
	bail: !argv.dev,
	context: __dirname,
	entry: './index.js',
	devtool: 'source-map',
	target: 'web',
	output: {
		path: './dist',
		filename: `${pkg.name}${argv.dev ? '' : '.min'}.js`,
		library: pkg.name,
		libraryTarget: 'umd',
		umdNamedDefine: true,
	},
	resolve: {
		extensions: ['.js'],
	},
	module: {
		rules: [
			{
				enforce: 'pre',
				loader: 'xo-loader',
				test: /\.js$/,
				include: [
					resolve('index.js'),
					resolve('source'),
				],
				options: {
					emitError: true,
					fix: true,
					rules: {
						'import/no-unresolved': 0,
					}
				},
			},
			{
				loader: 'es3ify-loader',
				test: /\.js$/,
				exclude: /node_modules/,
			}
		],
	},
	plugins: argv.dev ? [] : [
		new optimize.UglifyJsPlugin({
			minimize: true,
			output: {
				comments: false,
			},
		}),
		new CompressionWebpackPlugin({
			test: /\.js$/,
			asset: '[path].gz[query]',
			algorithm: 'gzip',
			threshold: 10240,
			minRatio: 0.8,
		}),
		new BannerPlugin({
			banner: pirateFlag(pkg, {
				moment: moment().format('LLLL'),
				commit: git.commithash(),
				homepage: pkg.homepage,
				author: pkg.author,<commit_msg>feat: adding gzip compression<commit_after>const { resolve } = require('path');
const { optimize, BannerPlugin } = require('webpack');
const CompressionWebpackPlugin = require('compression-webpack-plugin');
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const pirateFlag = require('pirate-flag');
const moment = require('moment');
const pkg = require('./package.json');

const git = new GitRevisionPlugin({ lightweightTags: true });

moment.locale();

module.exports = (argv = {}) => ({
	bail: !argv.dev,
	context: __dirname,
	entry: './index.js',
	devtool: 'source-map',
	target: 'web',
	output: {
		path: './dist',
		filename: `${pkg.name}${argv.dev ? '' : '.min'}.js`,
		library: pkg.name,
		libraryTarget: 'umd',
		umdNamedDefine: true,
	},
	resolve: {
		extensions: ['.js'],
	},
	module: {
		rules: [
			{
				enforce: 'pre',
				loader: 'xo-loader',
				test: /\.js$/,
				include: [
					resolve('index.js'),
					resolve('source'),
				],
				options: {
					emitError: true,
					fix: true,
					rules: {
						'import/no-unresolved': 0,
					}
				},
			},
			{
				loader: 'es3ify-loader',
				test: /\.js$/,
				exclude: /node_modules/,
			}
		],
	},
	plugins: argv.dev ? [] : [
		new optimize.UglifyJsPlugin({
			minimize: true,
			output: {
				comments: false,
			},
		}),
		new CompressionWebpackPlugin({
			test: /\.js$/,
			asset: '[path].gz[query]',
			algorithm: 'gzip',
			threshold: 300,
			minRatio: 0.8,
		}),
		new BannerPlugin({
			banner: pirateFlag(pkg, {
				moment: moment().format('LLLL'),
				commit: git.commithash(),
				homepage: pkg.homepage,
				author: pkg.author,
{'fraction_non_alphanumeric': 0.19052044609665428, 'fraction_numerical': 0.004956629491945477, 'mean_word_length': 3.1397435897435897, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '761788', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1122, 'n_words': 230}