Open himanshu-dhiman26 opened 4 years ago
I had the same issue and I think I figured it out: There was some issues with the new folder structure /src/
and/or the public/static
changes introduced in Next 9.1. My fix was to update the /public
path in next.config.js
modifyURLPrefix: {
'static/': '_next/static/',
'public/': '/',
},
``
hey @rix1 I'm having somewhat the same issue here:
I tried adding your solution but still same error:
const { withExpo } = require("@expo/next-adapter");
const withImages = require("next-images");
const withFonts = require("next-fonts");
const withOffline = require("next-offline");
module.exports = withExpo(
withOffline(
withFonts(
withImages({
projectRoot: __dirname,
workboxOpts: {
swDest: "workbox-service-worker.js",
/* changing any value means you'll have to copy over all the defaults */
/* next-offline */
globPatterns: ["static/**/*"],
globDirectory: ".",
modifyURLPrefix: {
"static/": "_next/static/",
"public/": "/"
},
runtimeCaching: [
{
urlPattern: /^https?.*/,
handler: "NetworkFirst",
options: {
cacheName: "offlineCache",
expiration: {
maxEntries: 200
}
}
}
]
}
})
)
)
);
You're using Now 2, right? Try using now dev
to spin up a local, serverless environment: https://zeit.co/blog/now-dev
Have you added a link to the manifest in your head? It took me a little to figure that out since it doesn't point it out in the readme. I assumed this plugin would do it for me but it doesn't (and I'm not sure it can)
Hi,
I am facing an issue while configuring my app to support PWA. I am using this package and this is how I am using it in my Next JS app.
I followed your
now2-example
for configurations.Following are my configuration files.
next.config.js
manifest.json
-> in public/manifest.jsonnow.json
When deploying using
now --prod
. Everything seems fine.But while testing it with Lighthouse. Getting the following error.
I thought it could be an issue with Lighthouse, but even if i try running it in mobile, it doesn't give me an option to 'Add to home screen'. So, I think definately something is wrong.
I am using NextJS 9, and next-offline v4.
Please help!
Thanks.