File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// src/client/next.config.js
22
33/** @type {import('next').NextConfig } */
4- import nextPWA from "next-pwa"
5-
6- const withPWA = nextPWA ( {
7- dest : "public" ,
8- disable : process . env . NODE_ENV === "development" ,
9- register : true ,
10- skipWaiting : true ,
11- exclude : [
12- // add buildExcludes here
13- ( { asset, compilation } ) => {
14- if (
15- asset . name . startsWith ( "server/" ) ||
16- asset . name . match (
17- / ^ ( ( a p p - | ^ ) b u i l d - m a n i f e s t \. j s o n | r e a c t - l o a d a b l e - m a n i f e s t \. j s o n ) $ /
18- )
19- ) {
20- return true
21- }
22- if (
23- process . env . NODE_ENV == "development" &&
24- ! asset . name . startsWith ( "static/runtime/" )
25- ) {
26- return true
27- }
28- return false
29- }
30- ] ,
31- runtimeCaching : [
32- // Cache Google Fonts
33- {
34- urlPattern : / ^ h t t p s : \/ \/ f o n t s \. g o o g l e a p i s \. c o m \/ .* / i,
35- handler : "CacheFirst" ,
36- options : {
37- cacheName : "google-fonts-cache" ,
38- expiration : {
39- maxEntries : 10 ,
40- maxAgeSeconds : 60 * 60 * 24 * 365 // 1 year
41- } ,
42- cacheableResponse : {
43- statuses : [ 0 , 200 ]
44- }
45- }
46- } ,
47- // Cache API data with a Stale-While-Revalidate strategy
48- {
49- urlPattern : / \/ a p i \/ / , // Match any API route
50- handler : "StaleWhileRevalidate" ,
51- options : {
52- cacheName : "api-data-cache" ,
53- expiration : {
54- maxEntries : 50 ,
55- maxAgeSeconds : 60 * 60 // 1 hour
56- } ,
57- cacheableResponse : {
58- statuses : [ 200 ]
59- }
60- }
61- }
62- ]
63- } )
644
655const nextConfig = {
666 images : {
You can’t perform that action at this time.
0 commit comments