I want to generate compressed resources files (br, or gz) after npm run prod with laravel.
My (simplified) webpack.mix.js (about the same with mix.styles too) :
const mix = require('laravel-mix');
mix.options({
cleanCss: {
level: {
1: {
specialComments: 'none'
}
}
},
purifyCss: true
});
mix.scripts([
'node_modules/popper.js/dist/umd/popper.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/toastr/build/toastr.min.js',
'resources/js/material/custom.js',
'resources/js/material/waves.js',
'node_modules/socket.io-client/dist/socket.io.js',
'node_modules/laravel-echo/dist/echo.iife.js'
],'public/js/admin-all.js');
const CompressionPlugin = require('compression-webpack-plugin');
mix.webpackConfig({
plugins: [
new CompressionPlugin({
filename: '[path].br[query]',
algorithm: 'brotliCompress',
test: /\.(js|css|html|svg)$/,
compressionOptions: { level: 11 },
minRatio: 1,
deleteOriginalAssets: false,
}),
]
});
I want to generate .css.br .js.br ... next to the .css or .js files in public folder But after npm run prod, no .br file generated.
npm run prod ===> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
It output a mix.js.br file but I dont know where the source of this file is ??
How to do it ?
npm version : 6.12.1 node version : 12.13 os : Windows 10 pro x64