moner.ooo/webpack.config.js

39 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

'use strict'
2024-05-24 16:48:12 +02:00
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { PurgeCSSPlugin } = require("purgecss-webpack-plugin");
const glob = require('glob-all');
2024-05-24 16:48:12 +02:00
module.exports = {
mode: 'development',
2024-05-24 16:48:12 +02:00
entry: './src/js/main.js',
output: {
filename: 'main.js',
2024-05-24 16:48:12 +02:00
path: path.resolve(__dirname, 'js'),
},
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '../css/main.css'
}),
new PurgeCSSPlugin({
paths: glob.sync([
2024-09-14 08:29:24 +02:00
path.join(__dirname, 'index.php'),
path.join(__dirname, 'src/js/*.js'),
path.join(__dirname, 'templates/*.php'),
]),
safelist: ['tooltip', 'fade', 'show', 'bs-tooltip-top', 'tooltip-inner', 'tooltip-arrow', 'btn-equals', 'btn-arrow', 'alert', 'alert-warning', 'donation-qr', 'donation-qr-toggle', 'donation-qr-container']
})
]
};