Socket
Socket
Sign inDemoInstall

next-pwa

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-pwa

Next.js with PWA, powered by workbox.


Version published
Weekly downloads
146K
decreased by-17.05%
Maintainers
1
Weekly downloads
Β 
Created

What is next-pwa?

next-pwa is a plugin for Next.js that helps you turn your Next.js application into a Progressive Web App (PWA) with minimal configuration. It provides features like offline support, caching strategies, and service worker integration.

What are next-pwa's main functionalities?

Offline Support

This configuration enables offline support by generating a service worker that caches your assets and pages, allowing your app to work offline.

const withPWA = require('next-pwa');

module.exports = withPWA({
  pwa: {
    dest: 'public'
  }
});

Custom Caching Strategies

This configuration allows you to define custom caching strategies for different types of assets. In this example, images are cached using a 'CacheFirst' strategy.

const withPWA = require('next-pwa');

module.exports = withPWA({
  pwa: {
    dest: 'public',
    runtimeCaching: [
      {
        urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
        handler: 'CacheFirst',
        options: {
          cacheName: 'images',
          expiration: {
            maxEntries: 50,
            maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
          },
        },
      },
    ],
  },
});

Service Worker Customization

This configuration allows you to customize the service worker behavior, such as enabling it only in production, skipping the waiting phase, and automatically registering it.

const withPWA = require('next-pwa');

module.exports = withPWA({
  pwa: {
    dest: 'public',
    register: true,
    skipWaiting: true,
    disable: process.env.NODE_ENV === 'development',
  },
});

Other packages similar to next-pwa

Keywords

FAQs

Package last updated on 24 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc