Configure for layer0 deployment

This commit is contained in:
Sam Carlton 2021-08-05 12:31:02 -05:00
parent f252322ccc
commit a8842fbb41
4 changed files with 32 additions and 0 deletions

2
.gitignore vendored
View file

@ -89,3 +89,5 @@ dist
.DS_Store
/static/tailwind.css
/.vscode/snipsnap.code-snippets
# Layer0 generated build directory
.layer0

10
layer0.config.js Normal file
View file

@ -0,0 +1,10 @@
'use strict'
// This file was automatically added by layer0 deploy.
// You should commit this file to source control.
module.exports = {
backends: {},
includeNodeModules: true,
connector: '@layer0/nuxt',
}

11
routes.js Normal file
View file

@ -0,0 +1,11 @@
// This file was added by layer0 init.
// You should commit this file to source control.
const { Router } = require('@layer0/core/router')
const { nuxtRoutes } = require('@layer0/nuxt')
module.exports = new Router()
.match('/service-worker.js', ({ serviceWorker }) => {
serviceWorker('.nuxt/dist/client/service-worker.js')
})
.use(nuxtRoutes)

9
sw/service-worker.js Normal file
View file

@ -0,0 +1,9 @@
import { skipWaiting, clientsClaim } from 'workbox-core'
import { precacheAndRoute } from 'workbox-precaching'
import { Prefetcher } from '@layer0/prefetch/sw'
skipWaiting()
clientsClaim()
precacheAndRoute(self.__WB_MANIFEST || [])
new Prefetcher().route()