forked from vikunja/frontend
Kind of fix registering the service worker
This commit is contained in:
parent
16b2e14841
commit
04e88be8ce
10
package.json
10
package.json
|
@ -5,7 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "npx vite preview",
|
"serve": "npx vite preview",
|
||||||
"serve:dist": "node scripts/serve-dist.js",
|
"serve:dist": "node scripts/serve-dist.js",
|
||||||
"build": "npx vite build",
|
"build": "npx workbox copyLibraries dist/ && npx vite build",
|
||||||
"build:report": "vue-cli-service build --report",
|
"build:report": "vue-cli-service build --report",
|
||||||
"lint": "vue-cli-service lint --ignore-pattern '*.test.*'",
|
"lint": "vue-cli-service lint --ignore-pattern '*.test.*'",
|
||||||
"cypress:open": "cypress open",
|
"cypress:open": "cypress open",
|
||||||
|
@ -30,7 +30,8 @@
|
||||||
"vue-easymde": "1.3.2",
|
"vue-easymde": "1.3.2",
|
||||||
"vue-shortkey": "3.1.7",
|
"vue-shortkey": "3.1.7",
|
||||||
"vue-smooth-dnd": "0.8.1",
|
"vue-smooth-dnd": "0.8.1",
|
||||||
"vuex": "3.6.2"
|
"vuex": "3.6.2",
|
||||||
|
"workbox-precaching": "^6.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "1.2.34",
|
"@fortawesome/fontawesome-svg-core": "1.2.34",
|
||||||
|
@ -55,13 +56,14 @@
|
||||||
"sass": "1.32.8",
|
"sass": "1.32.8",
|
||||||
"sass-loader": "10.1.1",
|
"sass-loader": "10.1.1",
|
||||||
"vite": "2.0.2",
|
"vite": "2.0.2",
|
||||||
"vite-plugin-pwa": "0.5.3",
|
"vite-plugin-pwa": "0.5.6",
|
||||||
"vite-plugin-vue2": "1.2.1",
|
"vite-plugin-vue2": "1.2.1",
|
||||||
"vue-flatpickr-component": "8.1.6",
|
"vue-flatpickr-component": "8.1.6",
|
||||||
"vue-notification": "1.3.20",
|
"vue-notification": "1.3.20",
|
||||||
"vue-router": "3.5.1",
|
"vue-router": "3.5.1",
|
||||||
"vue-template-compiler": "2.6.12",
|
"vue-template-compiler": "2.6.12",
|
||||||
"wait-on": "5.2.1"
|
"wait-on": "5.2.1",
|
||||||
|
"workbox-cli": "6.1.1"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|
|
@ -3,7 +3,7 @@ const express = require('express')
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
const p = path.join(__dirname, '..', 'dist')
|
const p = path.join(__dirname, '..', 'dist')
|
||||||
const port = 8080
|
const port = 8000
|
||||||
|
|
||||||
app.use(express.static(p))
|
app.use(express.static(p))
|
||||||
// Handle urls set by the frontend
|
// Handle urls set by the frontend
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
|
|
||||||
|
importScripts( "/workbox-v6.1.1/workbox-sw.js");
|
||||||
|
workbox.setConfig({modulePathPrefix: "/workbox-v6.1.1"});
|
||||||
|
|
||||||
|
import { precacheAndRoute } from 'workbox-precaching'
|
||||||
|
precacheAndRoute(self.__WB_MANIFEST)
|
||||||
|
|
||||||
// Cache assets
|
// Cache assets
|
||||||
workbox.routing.registerRoute(
|
workbox.routing.registerRoute(
|
||||||
// This regexp matches all files in precache-manifest
|
// This regexp matches all files in precache-manifest
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {register} from 'register-service-worker'
|
||||||
import swEvents from './ServiceWorker/events'
|
import swEvents from './ServiceWorker/events'
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
register(`${process.env.BASE_URL}sw.js`, {
|
register('/sw.js', {
|
||||||
ready() {
|
ready() {
|
||||||
console.log('App is being served from cache by a service worker.')
|
console.log('App is being served from cache by a service worker.')
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,9 +7,10 @@ module.exports = {
|
||||||
createVuePlugin(),
|
createVuePlugin(),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
strategies: 'injectManifest',
|
strategies: 'injectManifest',
|
||||||
|
injectRegister: false,
|
||||||
injectManifest: {
|
injectManifest: {
|
||||||
importWorkboxFrom: 'local',
|
|
||||||
swSrc: './src/ServiceWorker/sw.js',
|
swSrc: './src/ServiceWorker/sw.js',
|
||||||
|
swDest: './dist/sw.js',
|
||||||
},
|
},
|
||||||
manifest: {
|
manifest: {
|
||||||
name: 'Vikunja',
|
name: 'Vikunja',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user