Files
dspace-angular/webpack/webpack.browser.ts
Yury Bondarenko bde841918c 96252: Transform .json5 to .json in Webpack
This allows us to get rid of the json5 dependency in the main bundle and reduces the size of the i18n files we serve a bit
2022-10-25 21:01:21 +02:00

40 lines
1017 B
TypeScript

import { join } from 'path';
import { buildAppConfig } from '../src/config/config.server';
import { commonExports } from './webpack.common';
const CompressionPlugin = require('compression-webpack-plugin');
const zlib = require('zlib');
module.exports = Object.assign({}, commonExports, {
target: 'web',
plugins: [
...commonExports.plugins,
new CompressionPlugin({
filename: '[path][base].gz',
algorithm: 'gzip',
test: /\.(js|css|html|svg|json)$/,
threshold: 10240,
minRatio: 0.8,
}),
new CompressionPlugin({
filename: '[path][base].br',
algorithm: 'brotliCompress',
test: /\.(js|css|html|svg|json)$/,
compressionOptions: {
params: {
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
},
},
threshold: 10240,
minRatio: 0.8,
}),
],
devServer: {
setupMiddlewares(middlewares, server) {
buildAppConfig(join(process.cwd(), 'src/assets/config.json'));
return middlewares;
}
}
});