{"_id":"@byhuz/next-pwa","_rev":"23-98f8d368dc0069a68346573564274d6f","name":"@byhuz/next-pwa","dist-tags":{"latest":"2.4.3"},"versions":{"2.4.1":{"name":"@byhuz/next-pwa","version":"2.4.1","description":"Next.js with PWA, powered by workbox.","main":"index.js","repository":{"type":"git","url":"git+https://github.com/shadowwalker/next-pwa.git"},"author":{"name":"ShadowWalker","email":"w@weiw.io"},"license":"MIT","private":false,"keywords":["nextjs","pwa","workbox","web","service-worker"],"dependencies":{"clean-webpack-plugin":"^3.0.0","globby":"^11.0.0","workbox-webpack-plugin":"^5.1.3","workbox-window":"^5.1.3"},"devDependencies":{"webpack":"^4.41.5"},"peerDependencies":{"next":">=7.0.0","webpack":">=4.0.0"},"gitHead":"492eea7a69e5200ab038aafe91c354a76454859c","bugs":{"url":"https://github.com/shadowwalker/next-pwa/issues"},"homepage":"https://github.com/shadowwalker/next-pwa#readme","_id":"@byhuz/next-pwa@2.4.1","_nodeVersion":"12.16.1","_npmVersion":"6.14.4","dist":{"integrity":"sha512-a8BQ4JSTCw4Ezy2c6tHdc36cDtZpL9SU50xbBrQEiKTF3m95PV3e80CpMVifGfFc/dq+zy7LBMb+Q1Qy2rb3Zw==","shasum":"ab96b085ee330d975bf22697de2be4c257a8ba87","tarball":"https://registry.npmjs.org/@byhuz/next-pwa/-/next-pwa-2.4.1.tgz","fileCount":6,"unpackedSize":22496,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJewaZtCRA9TVsSAnZWagAAT7cP/3936/1uhTP/ezy/xi9A\nVjxGbYHSG1I5aBQKs/V84EetgLjcNItdufpTfHFUYF9+TRN+GZiqb253Z47J\ny7JNYEU2beBv/PjswHyKgyaLe8E3hKw+t/Gq3i4JTuRKRKExnTG7tigfVVIN\nBlNDoBA6kQeb78v0+1LbCFADccJftCvvWdowTlITtx6ZUWu2/49531Ysi45s\nz4PFZ/PYo2WqV9aU47H3wVqm++wCIRMvIadfuHYPeeVzA7Uty7//r6yVylg6\nL4hK3hYTluw+OwvsdlWwf05xAsOgRuZHT1EdTCgflfq6fJtKId86Swc0ePS2\nRx1xJLzA8AAYaWKm5QoVL7RDpxZTBaWv00nayJgtK4Y+V/X+KKXvv5/N/zmn\nlEiBT2tF3GVdVHs8F9T1Ud3iUcUlolXg/U9wBXlurRoG8v/DAnUBBcM4ltVk\n+RVeWHKxhDFx7ThXn1nETpCdoh7Q5ZxUHnoTqzNQST865oI6tyPb5usUbFGg\nhgszh7UZdaASPZ+G2XctxZKYOjhQKSxx0kVnXxnbAfzpZj5EhvLhfcB7ClJ5\n4fGUSH5hIXVWiOzU7eQzxT6kPYMH6NKrKD26kdk4/2XW+8jjcJcESKZ5jb0F\neFMVT+GJ6nnO6h2bWqZxh0Lq0mNz3Pw6dSRFlQ0ss6WVSnxHu8WSnFgELFRZ\nlE+m\r\n=dQT0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDhlhOdBxDIKIj0476rHWH2nutKxx1UhvN3tC/wcE+XkAiEAkLdbzfrLxhc988EygrvkB38sMBSXbMUuk6NT7/A43z8="}]},"maintainers":[{"name":"savasyilmaz","email":"savas.yilmaz@triodor.eu"},{"name":"alatella87","email":"a.latella@azerion.com"},{"name":"gokay-azerion","email":"b.erim@azerion.com"},{"name":"furkankursun","email":"f.kursun@azerion.com"},{"name":"e.buyuk","email":"e.boyuk@azerion.com"},{"name":"gboyraz","email":"gultekinboyraz@gmail.com"}],"_npmUser":{"name":"gboyraz","email":"gultekinboyraz@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-pwa_2.4.1_1589749356672_0.6580053880162327"},"_hasShrinkwrap":false},"2.4.2":{"name":"@byhuz/next-pwa","version":"2.4.2","description":"Next.js with PWA, powered by workbox.","main":"index.js","repository":{"type":"git","url":"git+https://github.com/shadowwalker/next-pwa.git"},"author":{"name":"ShadowWalker","email":"w@weiw.io"},"license":"MIT","private":false,"keywords":["nextjs","pwa","workbox","web","service-worker"],"dependencies":{"clean-webpack-plugin":"^3.0.0","globby":"^11.0.0","workbox-webpack-plugin":"^5.1.3","workbox-window":"^5.1.3"},"devDependencies":{"webpack":"^4.41.5"},"peerDependencies":{"next":">=7.0.0","webpack":">=4.0.0"},"gitHead":"492eea7a69e5200ab038aafe91c354a76454859c","bugs":{"url":"https://github.com/shadowwalker/next-pwa/issues"},"homepage":"https://github.com/shadowwalker/next-pwa#readme","_id":"@byhuz/next-pwa@2.4.2","_nodeVersion":"12.16.1","_npmVersion":"6.14.4","dist":{"integrity":"sha512-eev53Wc3KIi2NAk6nyFwhxn2O3yiFV5prJa2nv/cCYLTsqX9i3N28k6MQTN9+p0g483nRfr825pnv5GafmRTtA==","shasum":"92126ee4f91b888ce464f06728b9c52344a6e908","tarball":"https://registry.npmjs.org/@byhuz/next-pwa/-/next-pwa-2.4.2.tgz","fileCount":6,"unpackedSize":22527,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJewaewCRA9TVsSAnZWagAAjo4P/3m7OCr0UUn3BFda4Ku5\n1lwuK4US+j3wR+uuw9L/nyWK/fgDZhSNwU+RM6dSYpopHbTsYFQI1tJq6t0c\n1RCKZY2S8E6SbcIwmFK490S7aggvzRdeAHsb5hJ/fNDe7bZv9X9O3TSN8N2j\nl/PWTJqH6w5OMnOGxWpLqt0S0gL2wxZA64WidEKpSQIvHap8dGIoFkD9sDgx\n+lR+ZY91TwhpLsZVecqAw1gUORH0oooFKK2O3cLQO0LxWZ7mGNh6kqStp6TR\nxHeMfIMfOx1YzvtW1Tv6O1dm9N0ei8NFqOTlmgB1m0JutdsW5X1UtLHaaaEV\nXqeqORnoF7fiHBTjBg2ynv++dvgGSCS2jEhqRfBcSHF3OGdxRKBAo5Ke799q\n1mGi58yi5WeGWai3f4G0ZdWDHqBvfYKd49b3r1Aa/lg0D1neF2Uz0fM6LgHU\nZRkWI2pha7P9+eMFlCvrT065dvgT0zEm9diSapdN7ee/ivVy+z+1WUuzPRC3\nCX12OH4/4lzBUGhqL2WCbpVudjMEgMQBwNLGVziqUovXJl0YHwXOXRRGB3Wg\nooUufkdKqDAnO74ih5RDuOWWODNECEw5TruuKNR9F09u90sQm7pOGoRmF7Ab\nGatrj61NURPIsSiw8MhE0xDNLWAHbch8RMwXNHyZ1nwlig2ey0kFyWKpHewx\n84Rd\r\n=Q/zC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAsfEBjZPwrwJ2rGCYvelcZTzC67NGmf6EA+xAvECnncAiAG71dyL1pelTljc10pzRo69H2wOs3MbS597C8CGflVNw=="}]},"maintainers":[{"name":"alatella87","email":"a.latella@azerion.com"},{"name":"e.buyuk","email":"e.boyuk@azerion.com"},{"name":"furkankursun","email":"f.kursun@azerion.com"},{"name":"gboyraz","email":"gultekinboyraz@gmail.com"},{"name":"gokay-azerion","email":"b.erim@azerion.com"},{"name":"savasyilmaz","email":"savas.yilmaz@triodor.eu"}],"_npmUser":{"name":"gboyraz","email":"gultekinboyraz@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-pwa_2.4.2_1589749679767_0.9666274289460153"},"_hasShrinkwrap":false},"2.4.3":{"name":"@byhuz/next-pwa","version":"2.4.3","description":"Next.js with PWA, powered by workbox.","main":"index.js","repository":{"type":"git","url":"git+https://github.com/shadowwalker/next-pwa.git"},"author":{"name":"ShadowWalker","email":"w@weiw.io"},"license":"MIT","private":false,"keywords":["nextjs","pwa","workbox","web","service-worker"],"dependencies":{"clean-webpack-plugin":"^3.0.0","globby":"^11.0.0","workbox-webpack-plugin":"^5.1.3","workbox-window":"^5.1.3"},"devDependencies":{"webpack":"^4.41.5"},"peerDependencies":{"next":">=7.0.0","webpack":">=4.0.0"},"gitHead":"492eea7a69e5200ab038aafe91c354a76454859c","bugs":{"url":"https://github.com/shadowwalker/next-pwa/issues"},"homepage":"https://github.com/shadowwalker/next-pwa#readme","_id":"@byhuz/next-pwa@2.4.3","_nodeVersion":"12.16.1","_npmVersion":"6.14.4","dist":{"integrity":"sha512-IEb0LP+kGqi2PLbUnNljHeihazp+9jHa1A8xi5VSvempYTQSwogaM2Fp2XuDjgGBoWpslLPFkc7SHo3jLZ5qgg==","shasum":"908572b3f44ba0af9d47b70e05e2333c47598ee4","tarball":"https://registry.npmjs.org/@byhuz/next-pwa/-/next-pwa-2.4.3.tgz","fileCount":6,"unpackedSize":22560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2CFhCRA9TVsSAnZWagAAqxwQAJYdWXmY6hjrec1nTFI+\nY5q25bY2g43xX4i1bdI3/amQ9QhTUqVlZcvf/vA+O/37hdX7QyqKVL2Vdz/8\nEQuqddT3fyALYKlIxyRWt1VIFcY9wZbNFwUa8+ry6OJJFG2v47P08geZv7cf\n9lG15zFC/yF/afVwxYDae2ZF6M6kQqmWCZg7cE/30FAegfEYcOWiptBvD6gP\nyPLW4HGLbXmaQkV1B3uIDQHHYQPbWYdMZXaVmEmeHSaSPriF87rUHZzivKqb\njG4ec0HE9VAEC4IZg0MtUiBB1ZctZBz1pw9qDlKU42mnTPvWY9kdLEtwL3eI\nbR3zD2CtU2viLTuhT/Ddnp4CIolGZf2JSbVzWNrQgs4F1L2H4KKJWv/8a90A\ns1xgSNa5PioL2Sb1g/eE/fRDjchWMR5/K0eNeMS6+iR3n6M7tbRoCOgxSfad\nSZIyqJIV7ZQbaPk4ftRWYzrsoNTrPGzrrQKtyzIBlbzk07B7ONHeX9LQicFd\n0bq7IFsur0UlIuPIwUw6Dla/8fT11TXMQ7jVOdl8DIY1OnPeaG81qiqTBj1x\n0gT5PfDyLF2dEdu7mHKIUkDslZlmBLWBu1gs1dksvP8pEFsvUFfP3eg71d5m\nCi8Jr3Dtj/8how5AV4mMvc6rlC+drUiPTLMqP2hwr9lcjBXcUO6x7mJJ9DsR\ne5zh\r\n=NNLP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEGCglL5LXgi3/u8FGq54/i2LxEpqOnrwRZ6/02pj8Q9AiEAjGL9IYdJiYhfp3k3oPxZ4+aYMKxawn5s7P2GuCsmD+M="}]},"maintainers":[{"name":"alatella87","email":"a.latella@azerion.com"},{"name":"e.buyuk","email":"e.boyuk@azerion.com"},{"name":"furkankursun","email":"f.kursun@azerion.com"},{"name":"gboyraz","email":"gultekinboyraz@gmail.com"},{"name":"gokay-azerion","email":"b.erim@azerion.com"},{"name":"savasyilmaz","email":"savas.yilmaz@triodor.eu"}],"_npmUser":{"name":"gboyraz","email":"gultekinboyraz@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-pwa_2.4.3_1589750650416_0.855254561461033"},"_hasShrinkwrap":false}},"time":{"created":"2020-05-17T21:02:36.441Z","2.4.1":"2020-05-17T21:02:36.778Z","modified":"2023-06-06T12:54:34.677Z","2.4.2":"2020-05-17T21:07:59.880Z","2.4.3":"2020-05-17T21:24:10.538Z"},"maintainers":[{"email":"yagiz.aydin@azerion.com","name":"yagizaydin"},{"email":"demiremrece@gmail.com","name":"demiremrece"},{"email":"a.hulsman@azerion.com","name":"hulsman1986"},{"email":"gultekinboyraz@gmail.com","name":"gboyraz"}],"description":"Next.js with PWA, powered by workbox.","homepage":"https://github.com/shadowwalker/next-pwa#readme","keywords":["nextjs","pwa","workbox","web","service-worker"],"repository":{"type":"git","url":"git+https://github.com/shadowwalker/next-pwa.git"},"author":{"name":"ShadowWalker","email":"w@weiw.io"},"bugs":{"url":"https://github.com/shadowwalker/next-pwa/issues"},"license":"MIT","readme":"# Zero Config [PWA](https://developers.google.com/web/progressive-web-apps/) Plugin for [Next.js](https://nextjs.org/)\n\nThis plugin is powered by [workbox](https://developers.google.com/web/tools/workbox/) and other good stuff.\n\n![size](https://img.shields.io/bundlephobia/minzip/next-pwa.svg) ![dependencies](https://img.shields.io/david/shadowwalker/next-pwa.svg) ![downloads](https://img.shields.io/npm/dw/next-pwa.svg) ![license](https://img.shields.io/npm/l/next-pwa.svg)\n\n**Features**\n\n- 0️⃣ Zero config for registering and generating service worker\n- 📴 Completely offline support\n- 💯 Maximize lighthouse score\n- 📦 Use workbox and workbox-window v5\n- 🎈 Easy to understand examples\n- ☕ No custom server needed for Next.js 9+ [example](https://github.com/shadowwalker/next-pwa/tree/master/examples/next-9)\n- 🔧 Handle PWA lifecycle events opt-in [example](https://github.com/shadowwalker/next-pwa/tree/master/examples/lifecycle)\n- 📐 Custom worker to run extra code in service worker with code splitting [example](https://github.com/shadowwalker/next-pwa/tree/master/examples/custom-worker) 🆕\n- 🌏 Internationalization (a.k.a I18N) with `next-i18next` [example](https://github.com/shadowwalker/next-pwa/tree/master/examples/next-i18next)\n- ✨ Optimized precache and runtime cache\n- 🛠 Configurable by the same [workbox configuration options](https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin) for [GenerateSW](https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-webpack-plugin.GenerateSW) and [InjectManifest](https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-webpack-plugin.InjectManifest)\n- 🚀 Spin up a [GitPod](https://gitpod.io/#https://github.com/shadowwalker/next-pwa/) and try out examples in rocket speed\n\n> **NOTE** - `next-pwa` version 2.0.0+ should only work with `next.js` 9.1+, and static files should only be served through `public` directory. This will make things simpler.\n\n> **VERSION** `2.3.0`\n>\n> - service worker runs in dev mode as well, good for debugging functionality with service worker during development\n> - custom worker with code splitting, simply write your service worker in `worker/index.js`\n> - new option to exclude files in `public` folder from being precached\n\n----\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/shadowwalker/next-pwa/)\n\n## Install\n\n``` bash\nyarn add next-pwa\n```\n\n## Basic Usage\n\n### Step 1: withPWA\n\nUpdate or create `next.config.js` with\n\n``` javascript\nconst withPWA = require('next-pwa')\n\nmodule.exports = withPWA({\n  // other next config\n})\n```\n\nAfter running `next build`, this will generate two files in your `distDir` (default is `.next` folder): `workbox-*.js` and `sw.js`, which you need to serve statically, either through static file hosting service or using custom `server.js`.\n\n> If you are using Next.js 9+, you may not need a custom server to host your service worker files. Skip to next section to see the details.\n\n### Option 1: Host Static Files\n\nCopy files to your static file hosting server, so that they could be access using URL: `https://yourdomain.com/sw.js` and `https://yourdomain.com/workbox-*.js`.\n\nOne example is using firebase hosting service to host those files statically. You can automate the copy step using scripts in your deployment workflow.\n\n> For security reason, these files must be hosted directly from your domain. If the content is delivered using a redirect, the browser will refuse to run the service worker.\n\n### Option 2: Use Custom Server\n\nWhen a http request is received, test if those files are requested, then return those static files.\n\nExample `server.js`\n\n```javascript\nconst { createServer } = require('http')\nconst { join } = require('path')\nconst { parse } = require('url')\nconst next = require('next')\n\nconst app = next({ dev: process.env.NODE_ENV !== 'production' })\nconst handle = app.getRequestHandler()\n\napp.prepare()\n  .then(() => {\n    createServer((req, res) => {\n      const parsedUrl = parse(req.url, true)\n      const { pathname } = parsedUrl\n      \n      if (pathname === '/sw.js' || pathname.startsWith('/workbox-')) {\n        const filePath = join(__dirname, '.next', pathname)\n        app.serveStatic(req, res, filePath)\n      } else {\n        handle(req, res, parsedUrl)\n      }\n    })\n    .listen(3000, () => {\n      console.log(`> Ready on http://localhost:${3000}`)\n    })\n  })\n```\n\n> The following setup has nothing to do with `next-pwa` plugin, and you probably have already set them up. If not, go ahead and set them up.\n\n### Step 2: Add Manifest File (Example)\n\nCreate a `manifest.json` file in your `static` folder:\n\n```json\n{\n  \"name\": \"PWA App\",\n  \"short_name\": \"App\",\n  \"icons\": [\n    {\n      \"src\": \"/static/icons/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/static/icons/android-chrome-384x384.png\",\n      \"sizes\": \"384x384\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/static/icons/icon-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#FFFFFF\",\n  \"background_color\": \"#FFFFFF\",\n  \"start_url\": \"/\",\n  \"display\": \"standalone\",\n  \"orientation\": \"portrait\"\n}\n```\n\n### Step 3: Add Head Meta (Example)\n\nAdd following into `_document.jsx` or `_document.tsx`, in `<Head>`:\n\n``` typescript\n<meta name='application-name' content='PWA App' />\n<meta name='apple-mobile-web-app-capable' content='yes' />\n<meta name='apple-mobile-web-app-status-bar-style' content='default' />\n<meta name='apple-mobile-web-app-title' content='PWA App' />\n<meta name='description' content='Best PWA App in the world' />\n<meta name='format-detection' content='telephone=no' />\n<meta name='mobile-web-app-capable' content='yes' />\n<meta name='msapplication-config' content='/static/icons/browserconfig.xml' />\n<meta name='msapplication-TileColor' content='#2B5797' />\n<meta name='msapplication-tap-highlight' content='no' />\n<meta name='theme-color' content='#000000' />\n<meta name='viewport' content='minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover' />\n          \n<link rel='apple-touch-icon' sizes='180x180' href='/static/icons/apple-touch-icon.png' />\n<link rel='icon' type='image/png' sizes='32x32' href='/static/icons/favicon-32x32.png' />\n<link rel='icon' type='image/png' sizes='16x16' href='/static/icons/favicon-16x16.png' />\n<link rel='manifest' href='/static/manifest.json' />\n<link rel='mask-icon' href='/static/icons/safari-pinned-tab.svg' color='#5bbad5' />\n<link rel='shortcut icon' href='/static/icons/favicon.ico' />\n<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:300,400,500' />\n     \n<meta name='twitter:card' content='summary' />\n<meta name='twitter:url' content='https://yourdomain.com' />\n<meta name='twitter:title' content='PWA App' />\n<meta name='twitter:description' content='Best PWA App in the world' />\n<meta name='twitter:image' content='https://yourdomain.com/static/icons/android-chrome-192x192.png' />\n<meta name='twitter:creator' content='@DavidWShadow' />\n<meta property='og:type' content='website' />\n<meta property='og:title' content='PWA App' />\n<meta property='og:description' content='Best PWA App in the world' />\n<meta property='og:site_name' content='PWA App' />\n<meta property='og:url' content='https://yourdomain.com' />\n<meta property='og:image' content='https://yourdomain.com/static/icons/apple-touch-icon.png' />\n```\n\n## Usage Without Custom Server (next.js 9+)\n\nThanks to **Next.js 9+**, we can use `public` folder to serve static files from root `/` url path. It cuts the need to write custom server only to serve those files. Therefore the setup is more easy and concise. We can use `next.config.js` to config `next-pwa` to generates service worker and workbox files into `public`folder.\n\n### withPWA\n\n``` javascript\nconst withPWA = require('next-pwa')\n\nmodule.exports = withPWA({\n  pwa: {\n    dest: 'public'\n  }\n})\n```\n\n**[Use this example to see it in action](https://github.com/shadowwalker/next-pwa/tree/master/examples/next-9)**\n\n## Configuration\n\nThere are options you can use to customize behavior of this plugin by adding `pwa` object in the next config in `next.config.js`:\n\n```javascript\nconst withPWA = require('next-pwa')\n\nmodule.exports = withPWA({\n  pwa: {\n    disable: false,\n    register: true,\n    scope: '/app',\n    sw: 'service-worker.js',\n    //...\n  }\n})\n```\n\n### Available Options\n\n- disable: boolean - whether to disable pwa feature as a whole\n  - default to `false`\n  - set `disable: false`, so that it will generate service worker in both `dev` and `prod`\n  - set `disable: true` to completely disable PWA\n  - if you don't need debug service worker in `dev`, you can set `disable: process.env.NODE_ENV === \"development\"`\n- register: boolean - whether to let this plugin register service worker for you\n  - default to `true`\n  - set to `false` when you want to handle register service worker yourself, this could be done in `componentDidMount` of your root app. you can consider the [register.js](https://github.com/shadowwalker/next-pwa/blob/master/register.js) as an example.\n- scope: string - url scope for pwa\n  - default to `/`\n  - set to `/app`, so that all sub url under `/app` will be PWA, other url paths are still normal web app with no PWA support.\n- sw: string - service worker script file name\n  - default to `/sw.js`\n  - set to other file name if you want to customize the output service worker file name\n- runtimeCaching - caching strategies (array or callback function)\n  - default: see the **Default Runtime Caching** section for the default configuration\n  - accept an array of cache configurations\n- publicExcludes - array of glob pattern strings to excludes files in `public` folder being precached.\n  - default: `[]` - i.e. default behavior will precache all the files inside your `public` folder\n  - example: `['!img/super-large-image.jpg', '!fonts/not-used-fonts.otf']`\n- subdomainPrefix: string - url prefix to allow hosting static files on a subdomain\n  - default: `\"\"` - i.e. default with no prefix\n  - example: `/subdomain` if the app is hosted on `example.com/subdomain`\n\n### Other Options\n\n`next-pwa` uses `workbox-webpack-plugin`, other options which could also be put in `pwa` object can be find [**ON THE DOCUMENTATION**](https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin) for [GenerateSW](https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-webpack-plugin.GenerateSW) and [InjectManifest](https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-webpack-plugin.InjectManifest). If you specify `swSrc`, `InjectManifest` plugin will be used, otherwise `GenerateSW` will be used to generate service worker.\n\n### Default Runtime Caching\n\n`next-pwa` use a default runtime [cache.js](https://github.com/shadowwalker/next-pwa/blob/master/cache.js)\n\n## Tips\n\n1. [Common UX pattern to ask user to reload when new service worker is installed](https://github.com/shadowwalker/next-pwa/blob/master/examples/lifecycle/pages/index.js#L26-L38)\n2. Use a convention like `{command: 'doSomething', message: ''}` object when `postMessage` to service worker. So that on the listener, it could do multiple different tasks using `if...else...`.\n3. When you debugging service worker, constantly `clean application cache` to reduce some flaky errors.\n\n## Reference\n\n1. [Google Workbox](https://developers.google.com/web/tools/workbox/guides/get-started)\n2. [ServiceWorker, MessageChannel, & postMessage](https://ponyfoo.com/articles/serviceworker-messagechannel-postmessage) by [Nicolás Bevacqua](https://ponyfoo.com/contributors/ponyfoo)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}