Skip to content

Commit

Permalink
Use a custom servlet for serving files to support caching of files.
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Cunningham <[email protected]>
  • Loading branch information
digitaldan committed Oct 12, 2022
1 parent 79f5a6e commit 2556373
Show file tree
Hide file tree
Showing 4 changed files with 934 additions and 300 deletions.

This file was deleted.

20 changes: 19 additions & 1 deletion bundles/org.openhab.ui/web/build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const TerserPlugin = require('terser-webpack-plugin')
const WorkboxPlugin = require('workbox-webpack-plugin')
const WebpackAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const ESLintPlugin = require('eslint-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin')

const path = require('path')

Expand All @@ -29,7 +30,7 @@ module.exports = {
],
output: {
path: resolvePath(isCordova ? 'cordova/www' : 'www'),
filename: 'js/app.js',
filename: 'js/app.[hash].js',
publicPath: '/',
hotUpdateChunkFilename: 'hot/hot-update.js',
hotUpdateMainFilename: 'hot/hot-update.json'
Expand Down Expand Up @@ -236,6 +237,23 @@ module.exports = {
swSrc: resolvePath('src/service-worker.js')
})
] : []),
new CompressionPlugin({
filename: '[path][base].gz',
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/,
threshold: 0,
minRatio: Infinity,
}),
new CompressionPlugin({
filename: '[path][base].br',
algorithm: 'brotliCompress',
test: /\.(js|css|html|svg)$/,
compressionOptions: {
level: 11,
},
threshold: 0,
minRatio: Infinity,
}),
...(process.env.WEBPACK_ANALYZER ? [
new WebpackAnalyzerPlugin(process.env.WEBPACK_ANALYZER_REPORT ? {
analyzerMode: 'static',
Expand Down
Loading

0 comments on commit 2556373

Please sign in to comment.