-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2249 from graphcommerce-org/fix/servist
Move service worker to serwist
- Loading branch information
Showing
41 changed files
with
502 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { | ||
runtimeCaching, | ||
PrecacheEntry, | ||
Serwist, | ||
productionCaching, | ||
} from '@graphcommerce/service-worker' | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents | ||
declare const self: ServiceWorkerGlobalScope & { | ||
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined | ||
} | ||
|
||
const serwist = new Serwist({ | ||
// eslint-disable-next-line no-underscore-dangle | ||
precacheEntries: self.__SW_MANIFEST, | ||
skipWaiting: true, | ||
clientsClaim: true, | ||
navigationPreload: true, | ||
runtimeCaching: productionCaching, | ||
disableDevLogs: true, | ||
}) | ||
|
||
serwist.addEventListeners() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { withGraphCommerce } from '@graphcommerce/next-config' | ||
import withSerwistInit from '@serwist/next' | ||
import dotenv from 'dotenv' | ||
|
||
dotenv.config() | ||
|
||
const withPWA = withSerwistInit({ | ||
// disable: process.env.NODE_ENV === 'development', | ||
swSrc: 'lib/sw.ts', | ||
swDest: 'public/sw.js', | ||
exclude: [/sitemap/, /robots/, 'sw.js'], | ||
}) | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
onDemandEntries: { | ||
maxInactiveAge: 1000 * 60 * 10, | ||
pagesBufferLength: 10, | ||
}, | ||
images: { | ||
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384], | ||
}, | ||
eslint: { | ||
ignoreDuringBuilds: true, | ||
}, | ||
} | ||
|
||
export default withGraphCommerce(withPWA(nextConfig)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { PrecacheEntry, SerwistGlobalConfig } from '@graphcommerce/service-worker' | ||
import { runtimeCaching, Serwist } from '@graphcommerce/service-worker' | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents | ||
declare const self: SerwistGlobalConfig & { | ||
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined | ||
} | ||
|
||
const serwist = new Serwist({ | ||
// eslint-disable-next-line no-underscore-dangle | ||
precacheEntries: self.__SW_MANIFEST, | ||
skipWaiting: true, | ||
clientsClaim: true, | ||
navigationPreload: true, | ||
runtimeCaching, | ||
}) | ||
|
||
serwist.addEventListeners() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.