rsnext/examples/next-offline/next.config.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
696 B
JavaScript
Raw Normal View History

// @ts-check
const withOffline = require("next-offline");
/**
* @type {import('next').NextConfig}
**/
const nextConfig = {
workboxOpts: {
swDest: process.env.NEXT_EXPORT
? "service-worker.js"
: "static/service-worker.js",
2020-01-02 17:50:27 +01:00
runtimeCaching: [
{
urlPattern: /^https?.*/,
handler: "NetworkFirst",
options: {
cacheName: "offlineCache",
expiration: {
maxEntries: 200,
},
},
},
],
},
async rewrites() {
return [
{
source: "/service-worker.js",
destination: "/_next/static/service-worker.js",
},
];
},
};
module.exports = withOffline(nextConfig);