mirror of
https://github.com/go-gitea/gitea
synced 2025-07-15 23:17:19 +00:00
Move serviceworker to workbox and fix SSE interference
Instead of statically hardcoding every frontend asset, this uses a type-based approach to cache all js,css and manifest.json requests. This also fixes the issue that the service worker was interfering with EventSource because it was unconditionally handling all requests which this new implementation doesn't. Fixes: https://github.com/go-gitea/gitea/issues/11092 Fixes: https://github.com/go-gitea/gitea/issues/7372
This commit is contained in:
@@ -35,13 +35,20 @@ module.exports = {
|
||||
jquery: [
|
||||
resolve(__dirname, 'web_src/js/jquery.js'),
|
||||
],
|
||||
serviceworker: [
|
||||
resolve(__dirname, 'web_src/js/serviceworker.js'),
|
||||
],
|
||||
icons: glob('node_modules/@primer/octicons/build/svg/**/*.svg'),
|
||||
...themes,
|
||||
},
|
||||
devtool: false,
|
||||
output: {
|
||||
path: resolve(__dirname, 'public'),
|
||||
filename: 'js/[name].js',
|
||||
filename: ({chunk}) => {
|
||||
// serviceworker can only manage assets below it's script path so we
|
||||
// have to put it in / instead of /js/
|
||||
return chunk.id === 'serviceworker' ? '[name].js' : 'js/[name].js';
|
||||
},
|
||||
chunkFilename: 'js/[name].js',
|
||||
},
|
||||
optimization: {
|
||||
|
Reference in New Issue
Block a user