udrone/webpack.config.js

58 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-08-18 22:20:07 +03:00
const path = require('path');
2022-09-22 23:18:43 +03:00
const WebpackBuildNotifierPlugin = require('webpack-build-notifier');
const CompressionPlugin = require("compression-webpack-plugin");
2022-08-18 22:20:07 +03:00
2022-09-22 23:18:43 +03:00
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'),
},
}
2022-08-18 22:20:07 +03:00
};