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