Reputation: 4608
I am creating a setup for Next.js PWA but its not wokring. I have tried with
Created manifest.json
and other icons
inside public
folder.
Created _document.js
inside src/pages
with below text
import Document, { Html, Head, Main, NextScript, } from 'next/document'
class MyDocument extends Document { render() { return ( ) } }
export default MyDocument
Updated next.config
file with
const withPWA = require('next-pwa')({
dest: 'public',
register: true,
skipWaiting: true,
disable: process.env.NODE_ENV === 'development'
})
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true
}
module.exports = withPWA(nextConfig)
Created fresh build but still browser not showing download icon. Note sure what is missed ?
Upvotes: 1
Views: 140
Reputation: 4608
Issue was in selecting src
folder. Working file location /pages/_document.js
but if we put pages folder inside src
fodler like /src/pages/_document.js
then it does not works.
Upvotes: 0