# @ducanh2912/next-sw

> PWA for Next.js, powered by pure ServiceWorker.

Latest version **1.1.0** (published 2023-06-20) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @ducanh2912/next-sw
pnpm add @ducanh2912/next-sw
yarn add @ducanh2912/next-sw
bun add @ducanh2912/next-sw
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-06-20 |
| First published | 2023-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 76.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (Unknown) |
| GitHub stars | 680 |
| Author | DuCanhGH |
| Maintainers | ducanh2912 |
| Keywords | next.js, pwa, web, serviceworker |

## Links

- npm: https://www.npmjs.com/package/@ducanh2912/next-sw
- Repository: https://github.com/DuCanhGH/next-pwa
- Homepage: https://github.com/DuCanhGH/next-pwa#readme
- Issues: https://github.com/DuCanhGH/next-pwa/issues
- npm.io page: https://npm.io/package/@ducanh2912/next-sw

## Dependencies (2)

- [clean-webpack-plugin](https://npm.io/package/clean-webpack-plugin.md) 4.0.0
- [terser-webpack-plugin](https://npm.io/package/terser-webpack-plugin.md) 5.3.9

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-06-20
- 1.0.0 — 2023-05-09
- 1.0.0-alpha.1 — 2023-05-09

## README

> **NOTE**: This package is not ready at the moment. Please use `@ducanh2912/next-pwa` instead.

# Zero-config [PWA](https://web.dev/learn/pwa/) plugin for [Next.js](https://nextjs.org/)

This plugin is powered by [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) and other good stuff.

[![Build Size](https://img.shields.io/bundlephobia/minzip/@ducanh2912/next-sw?label=Bundle%20size&style=flat&color=success)](https://bundlephobia.com/result?p=@ducanh2912/next-sw)
[![Version](https://img.shields.io/npm/v/@ducanh2912/next-sw?style=flat&color=success)](https://www.npmjs.com/package/@ducanh2912/next-sw)

**Features**

- 0️⃣ Zero-config for registering and generating service worker out of the box
- ✨ Optimized precaching and runtime caching (in progress)
- 💯 Maximal Lighthouse score (not guaranteed for now)
- 🎈 Easy-to-understand examples
- 📦 Uses [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)
- 🛠 Configurable (more in future!)
- 🚀 Spin up a [GitPod](https://gitpod.io/#https://github.com/DuCanhGH/next-pwa/) and try out examples in rocket speed (or use `create-next-app` to create a brand new Next.js app with them (for example, run `pnpm create next-app --example https://github.com/DuCanhGH/next-pwa/tree/master/examples/workboxless` to create a new Next.js app using the `basic` example))

> **NOTE 1** - `next-pwa` version 2.0.0+ should only work with `Next.js` 9.1+, and static files should only be served through the `public` directory.
>
> **NOTE 2** - `@ducanh2912/next-sw` currently doesn't support Turbopack, but I will start working on it as soon as we get our hands on Turbopack.

---

[![Open in Gitpod](https://img.shields.io/badge/Open%20In-Gitpod.io-%231966D2?style=for-the-badge&logo=gitpod)](https://gitpod.io/#https://github.com/DuCanhGH/next-pwa/)

## How is it different from `@ducanh2912/next-pwa`?

It directly makes use of the `ServiceWorker` API instead of `workbox`. Both are supported, so just make a pick! If you are not sure, you may want to use `@ducanh2912/next-pwa` instead as it allows you to customize your service worker further.

## Reference

1. [ServiceWorker, MessageChannel, & postMessage](https://ponyfoo.com/articles/serviceworker-messagechannel-postmessage) by [Nicolás Bevacqua](https://ponyfoo.com/contributors/ponyfoo)
2. [The service worker lifecycle](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle)
3. [6 Tips to make your iOS PWA feel like a native app](https://www.netguru.com/codestories/pwa-ios)
4. [Make your PWA available on Google Play Store](https://www.netguru.com/codestories/make-your-pwa-available-on-google-play-store)

---
_Source: https://npm.io/package/@ducanh2912/next-sw · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
