mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-12-22 13:33:37 +00:00
Fix PWA support.
This commit is contained in:
parent
4bfbb9aa2e
commit
179dcbb687
@ -17,7 +17,6 @@
|
||||
"hotkeys-js": "^3.8.7",
|
||||
"javascript-time-ago": "^2.3.10",
|
||||
"mux.js": "^6.0.1",
|
||||
"register-service-worker": "^1.7.1",
|
||||
"shaka-player": "3.3.0",
|
||||
"uikit": "3.9.4",
|
||||
"vue": "^3.2.26",
|
||||
@ -35,6 +34,7 @@
|
||||
"eslint-plugin-vue": "^7.20.0",
|
||||
"prettier": "^2.5.1",
|
||||
"vite": "^2.7.8",
|
||||
"vite-plugin-pwa": "^0.11.12",
|
||||
"vite-plugin-windicss": "^1.6.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
@ -1,33 +1,7 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import { register } from "register-service-worker";
|
||||
import { registerSW } from "virtual:pwa-register";
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
register(`/service-worker.js`, {
|
||||
ready() {
|
||||
console.log(
|
||||
"App is being served from cache by a service worker.\n" +
|
||||
"For more details, visit https://goo.gl/AFskqB",
|
||||
);
|
||||
},
|
||||
registered() {
|
||||
console.log("Service worker has been registered.");
|
||||
},
|
||||
cached() {
|
||||
console.log("Content has been cached for offline use.");
|
||||
},
|
||||
updatefound() {
|
||||
console.log("New content is downloading.");
|
||||
},
|
||||
updated() {
|
||||
console.log("New content is available; please refresh.");
|
||||
window.location.reload();
|
||||
},
|
||||
offline() {
|
||||
console.log("No internet connection found. App is running in offline mode.");
|
||||
},
|
||||
error(error) {
|
||||
console.error("Error during service worker registration:", error);
|
||||
},
|
||||
});
|
||||
registerSW();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import WindiCSS from "vite-plugin-windicss";
|
||||
import vueI18n from "@intlify/vite-plugin-vue-i18n";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
import path from "path";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
@ -12,6 +13,7 @@ export default defineConfig({
|
||||
vueI18n({
|
||||
include: path.resolve(__dirname, "./src/locales/**"),
|
||||
}),
|
||||
VitePWA({ registerType: "autoUpdate" }),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
Loading…
Reference in New Issue
Block a user