Update webpack

This commit is contained in:
Sonny Bakker 2024-08-24 15:19:01 +02:00
parent 8b080a3cee
commit 07c685401f
4 changed files with 7600 additions and 20286 deletions

View file

@ -10,7 +10,6 @@ export default {
output: {
path: resolve(__dirname, 'src', 'newsreader', 'static'),
filename: 'js/[name].bundle.js',
hashFunction: 'sha256',
},
module: {
rules: [
@ -24,23 +23,27 @@ export default {
use: [{ loader: MiniCssExtractPlugin.loader }, 'css-loader', 'sass-loader'],
},
{
test: /\.(ttf|woff|woff2)$/,
use: {
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts',
publicPath: '/static/fonts/',
},
test: /\.(ttf|woff|woff2|eot)$/,
type: 'asset/resource',
generator: {
filename: '[name][ext]',
outputPath: 'fonts',
publicPath: '/fonts/',
},
},
{
test: /\.(svg)$/,
type: 'asset/resource',
generator: {
filename: '[name][ext]',
outputPath: 'images',
publicPath: '/fonts/',
},
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: 'css/main.css',
allChunks: true,
}),
new MiniCssExtractPlugin({ filename: 'css/main.css' }),
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['js', 'css', 'fonts'],
cleanAfterEveryBuildPatterns: ['!fonts/**'],