npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@swavoti/next-pwa

v1.0.7

Published

A library for turning Next.js applications into Progressive Web Apps.

Readme

@swavoti/next-pwa

npm version

Turn your Next.js application into a high-performance Progressive Web App (PWA) with a single line of code. This library automatically configures a service worker to provide offline capabilities, asset caching, and a native-like experience for your users.

Features

  • Zero-Configuration PWA: Simply wrap your Next.js config and get a fully functional PWA.
  • Offline First: Your application will load from the cache first, making it available even when the user is offline.
  • Advanced Caching Strategies:
    • Network-First for Pages: Ensures users always get the latest content when online, with a fallback to the cache.
    • Cache-First for Assets: Images, videos, scripts, and styles are served instantly from the cache for blazingly fast load times.
  • Automatic Service Worker: The service worker is automatically generated and registered, with no extra setup required.
  • Seamless Integration: Works with your existing Next.js project without requiring any changes to your application code.

Installation

Install the library using npm:

npm install @swavoti/next-pwa

Usage

To enable PWA capabilities in your Next.js project, simply wrap your next.config.js with the withPWA function.

// next.config.js
const { withPWA } = require('@swavoti/next-pwa');

const nextConfig = {
  // Your existing Next.js configuration
};

module.exports = withPWA(nextConfig);

Important Note for Next.js 16+ Users:

As of Next.js 16, the default build engine is Turbopack. This library relies on modifying the webpack configuration, so you must force Next.js to use webpack.

Update the build script in your package.json like this:

{
  "scripts": {
    "dev": "next dev",
    "build": "next build --webpack",
    "start": "next start"
  }
}

And that's it! The next time you build your project, @swavoti/next-pwa will automatically add a service worker to your application.

How It Works

This library extends your Next.js build process to do two things:

  1. Copies the Service Worker: It copies a pre-configured service worker (sw.js) into your project's public directory.
  2. Injects the Registration Script: It injects a script into your application's client-side bundle to register the service worker in the browser.

The result is a seamless PWA experience with no manual configuration needed.

License

This library is provided free of charge and can be used in any project.

The name and code of this library are a trademark of Swavoti South Africa (Pty) Ltd.

  • You are permitted to use this library in your projects, commercial or otherwise.
  • You are not permitted to modify, distribute, or sublicense the original code.

Only Swavoti South Africa (Pty) Ltd is authorized to maintain and publish updates to this library.