Merge pull request #4885 from nielsvanvelzen/nvv-drop-workbox
This commit is contained in:
commit
05e2186882
5 changed files with 11 additions and 1515 deletions
1488
package-lock.json
generated
1488
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -65,7 +65,6 @@
|
|||
"webpack-cli": "5.1.4",
|
||||
"webpack-dev-server": "4.15.1",
|
||||
"webpack-merge": "5.9.0",
|
||||
"workbox-webpack-plugin": "6.6.0",
|
||||
"worker-loader": "3.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -118,9 +117,7 @@
|
|||
"sortablejs": "1.15.0",
|
||||
"swiper": "9.3.2",
|
||||
"webcomponents.js": "0.7.24",
|
||||
"whatwg-fetch": "3.6.2",
|
||||
"workbox-core": "6.6.0",
|
||||
"workbox-precaching": "6.6.0"
|
||||
"whatwg-fetch": "3.6.2"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 2 Firefox versions",
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
/* eslint-env serviceworker */
|
||||
|
||||
/* eslint-disable import/namespace,import/named */
|
||||
import { skipWaiting, clientsClaim } from 'workbox-core';
|
||||
import { precacheAndRoute } from 'workbox-precaching';
|
||||
/* eslint-enable import/namespace,import/named */
|
||||
|
||||
skipWaiting();
|
||||
clientsClaim();
|
||||
|
||||
function getApiClient(serverId) {
|
||||
return Promise.resolve(window.connectionManager.getApiClient(serverId));
|
||||
}
|
||||
|
@ -44,9 +36,5 @@ self.addEventListener('notificationclick', function (event) {
|
|||
event.waitUntil(executeAction(action, data, serverId));
|
||||
}, false);
|
||||
|
||||
// Do not precache files when running with webpack dev server so live reload works as expected
|
||||
if (!__WEBPACK_SERVE__) { // eslint-disable-line no-undef
|
||||
// this is needed by the webpack Workbox plugin
|
||||
/* eslint-disable-next-line no-restricted-globals,no-undef */
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
}
|
||||
/* eslint-disable-next-line no-restricted-globals -- self is valid in a serviceworker environment */
|
||||
self.addEventListener('activate', () => self.clients.claim());
|
||||
|
|
|
@ -110,7 +110,9 @@ const config = {
|
|||
})
|
||||
],
|
||||
output: {
|
||||
filename: '[name].bundle.js',
|
||||
filename: pathData => (
|
||||
pathData.chunk.name === 'serviceworker' ? '[name].js' : '[name].bundle.js'
|
||||
),
|
||||
chunkFilename: '[name].[contenthash].chunk.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
publicPath: ''
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
const path = require('path');
|
||||
const common = require('./webpack.common');
|
||||
const { merge } = require('webpack-merge');
|
||||
const WorkboxPlugin = require('workbox-webpack-plugin');
|
||||
|
||||
module.exports = merge(common, {
|
||||
mode: 'production',
|
||||
entry: { 'main.jellyfin': './index.jsx' },
|
||||
plugins: [
|
||||
new WorkboxPlugin.InjectManifest({
|
||||
swSrc: path.resolve(__dirname, 'src/serviceworker.js'),
|
||||
swDest: 'serviceworker.js'
|
||||
})
|
||||
]
|
||||
entry: {
|
||||
'main.jellyfin': './index.jsx',
|
||||
'serviceworker': './serviceworker.js'
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue