Skip to content

Commit

Permalink
Updated to new PWA package
Browse files Browse the repository at this point in the history
  • Loading branch information
jLynx committed Jan 1, 2024
1 parent d23fcb7 commit 6665679
Show file tree
Hide file tree
Showing 7 changed files with 731 additions and 3,983 deletions.
9 changes: 8 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ const nextConfig = {
};

// Configuration object tells the next-pwa plugin
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public", // Destination directory for the PWA files
disable: process.env.NODE_ENV === "development", // Disable PWA in development mode
register: true, // Register the PWA service worker
skipWaiting: true, // Skip waiting for service worker activation
fallbacks: {
image: "/static/images/fallback.png",
// document: '/other-offline', // if you want to fallback to a custom page other than /_offline
// font: '/static/font/fallback.woff2',
// audio: ...,
// video: ...,
},
});

module.exports = withPWA(nextConfig);
4,691 changes: 711 additions & 3,980 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"lint": "next lint"
},
"dependencies": {
"@ducanh2912/next-pwa": "^10.0.2",
"next": "14.0.4",
"next-pwa": "^5.6.0",
"react": "^18",
"react-dom": "^18"
},
Expand Down
1 change: 1 addition & 0 deletions public/fallback-382b0be8edf4f83a.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
{
"src": "icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "icons/icon-384x384.png",
Expand Down
Binary file added public/static/images/fallback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/app/offline/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use client"

const Fallback = () => {
return (
<p>Hello, we should be offline</p>
)
}
export default Fallback

0 comments on commit 6665679

Please sign in to comment.