const path = require('path'); const WebpackBuildNotifierPlugin = require('webpack-build-notifier'); const CompressionPlugin = require("compression-webpack-plugin"); module.exports = (env, argv) => { const isProduction = argv.mode === 'production'; return { performance: { maxAssetSize: 5000000, maxEntrypointSize: 5000000, }, entry: path.resolve(__dirname, './src/index.js'), module: { rules: [ { test: /\.(js)$/, exclude: /node_modules/, use: ['babel-loader'] } ] }, plugins: [ new WebpackBuildNotifierPlugin({ title: "UDrone", suppressSuccess: false, // don't spam success notifications }), ], optimization: { minimize: isProduction, minimizer: [ (compiler) => { const TerserPlugin = require('terser-webpack-plugin'); new TerserPlugin({ terserOptions: { compress: {}, } }).apply(compiler); }, new CompressionPlugin({ test: /\.js(\?.*)?$/i, }) ], }, resolve: { extensions: ['*', '.js'] }, output: { path: path.resolve(__dirname, './dist'), filename: 'bundle.js', }, devServer: { static: path.resolve(__dirname, './dist'), }, } };