2024-09-04 06:07:58 +00:00
|
|
|
'use strict';
|
2024-05-24 14:48:12 +00:00
|
|
|
|
2024-08-08 06:43:32 +00:00
|
|
|
const path = require('path');
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
2024-09-04 06:07:58 +00:00
|
|
|
const { PurgeCSSPlugin } = require('purgecss-webpack-plugin');
|
2024-08-08 06:43:32 +00:00
|
|
|
const glob = require('glob-all');
|
2024-09-04 06:07:58 +00:00
|
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
2024-05-24 14:48:12 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2024-09-04 06:07:58 +00:00
|
|
|
mode: 'production',
|
2024-05-24 14:48:12 +00:00
|
|
|
entry: './src/js/main.js',
|
|
|
|
output: {
|
2024-09-04 06:07:58 +00:00
|
|
|
filename: '[name].js',
|
2024-05-24 14:48:12 +00:00
|
|
|
path: path.resolve(__dirname, 'js'),
|
|
|
|
},
|
2024-08-08 06:43:32 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
|
|
|
'css-loader'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new MiniCssExtractPlugin({
|
2024-09-04 06:03:45 +00:00
|
|
|
filename: '../css/[name].css'
|
2024-08-08 06:43:32 +00:00
|
|
|
}),
|
|
|
|
new PurgeCSSPlugin({
|
|
|
|
paths: glob.sync([
|
2024-09-04 06:03:45 +00:00
|
|
|
path.join(__dirname, 'index.php'),
|
|
|
|
path.join(__dirname, 'src/js/**/*.js')
|
2024-08-08 06:43:32 +00:00
|
|
|
]),
|
2024-09-04 06:03:45 +00:00
|
|
|
only: ['bootstrap'],
|
2024-08-10 14:43:57 +00:00
|
|
|
safelist: ['tooltip', 'fade', 'show', 'bs-tooltip-top', 'tooltip-inner', 'tooltip-arrow', 'btn-equals', 'btn-arrow', 'alert', 'alert-warning']
|
2024-08-08 06:43:32 +00:00
|
|
|
})
|
2024-09-04 06:07:58 +00:00
|
|
|
],
|
|
|
|
optimization: {
|
|
|
|
minimize: true,
|
|
|
|
minimizer: [
|
|
|
|
new TerserPlugin({
|
|
|
|
terserOptions: {
|
|
|
|
compress: {
|
|
|
|
drop_console: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
new CssMinimizerPlugin(),
|
|
|
|
],
|
|
|
|
}
|
2024-09-04 06:03:45 +00:00
|
|
|
};
|