mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Serve gzip and brotli compressed assets.
This commit is contained in:
parent
000623ee01
commit
1f32cbd613
4 changed files with 241 additions and 8 deletions
|
@ -22,6 +22,9 @@
|
|||
var Encore = require('@symfony/webpack-encore');
|
||||
const CopyPlugin = require('copy-webpack-plugin');
|
||||
|
||||
const zlib = require('zlib');
|
||||
const CompressionPlugin = require("compression-webpack-plugin");
|
||||
|
||||
// Manually configure the runtime environment if not already configured yet by the "encore" command.
|
||||
// It's useful when you use tools that rely on webpack.config.js file.
|
||||
if (!Encore.isRuntimeEnvironmentConfigured()) {
|
||||
|
@ -105,6 +108,26 @@ Encore
|
|||
}
|
||||
]))
|
||||
|
||||
.addPlugin(new CompressionPlugin({
|
||||
filename: '[path].br[query]',
|
||||
algorithm: 'brotliCompress',
|
||||
test: /\.(js|css|html|svg)$/,
|
||||
compressionOptions: {
|
||||
// zlib’s `level` option matches Brotli’s `BROTLI_PARAM_QUALITY` option.
|
||||
level: 11,
|
||||
},
|
||||
//threshold: 10240,
|
||||
minRatio: 0.8,
|
||||
deleteOriginalAssets: false,
|
||||
}))
|
||||
|
||||
.addPlugin(new CompressionPlugin({
|
||||
filename: '[path].gz[query]',
|
||||
algorithm: 'gzip',
|
||||
test: /\.(js|css|html|svg)$/,
|
||||
deleteOriginalAssets: false,
|
||||
}))
|
||||
|
||||
// uncomment if you use API Platform Admin (composer req api-admin)
|
||||
//.enableReactPreset()
|
||||
//.addEntry('admin', './assets/js/admin.js')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue