-
-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Description
The main issue I'm trying to figure out right now is I noticed workbox/the service worker that withPWA sets up, starts precaching everything I specified but on EVERY route, such as our login page. But I would like to restrict this to just precache when on specific routes like /test or /other so it doesn't bog down my entire website for no reason.
Is there a way to do this. Here is my current config
await import("./src/env.mjs");
import { nanoid } from "nanoid";
import i18n from "./next-i18next.config.js";
import withPWA from "next-pwa";
const buildId = nanoid();
const pwa = withPWA({
dest: "public",
scope: "/test",
additionalManifestEntries: [
{ url: "/logo.svg", revision: "1" },
{ url: "/test", revision: "1" },
{ url: "/other", revision: "1" },
{ url: "/en/test", revision: "1" },
{ url: "/en/other", revision: "1" },
{ url: `_next/data/${buildId}/en/test.json`, revision: "1" },
{ url: `_next/data/${buildId}/en/other.json`, revision: "1" },
{ url: "/es/test", revision: "1" },
{ url: "/es/other", revision: "1" },
{ url: `_next/data/${buildId}/es/test.json`, revision: "1" },
{ url: `_next/data/${buildId}/es/other.json`, revision: "1" },
{ url: `_next/data/${buildId}/en.json`, revision: "1" },
{ url: `_next/data/${buildId}/es.json`, revision: "1" },
// ... other routes
],
});
/** @type {import("next").NextConfig} */
const config = pwa({
generateBuildId: () => buildId,
reactStrictMode: true,
/**
* If you have `experimental: { appDir: true }` set, then you must comment the below `i18n` config
* out.
*
* @see https://github.com/vercel/next.js/issues/41980
*/
i18n: i18n.i18n,
});
export default config;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels