Skip to content

Service worker gets changed every build (output not reproducible) #501

Open
@elliot-nelson

Description

Summary

A client app team working on a Nextjs app recently added the next-pwa toolchain, and what we are noticing is that even if all inputs (i.e. dependencies and source files) have not changed, the output file is not reproducible -- it keeps changing every build, which is breaking our build caching.

Versions

  • next-pwa: 5.6.0
  • next: 13.5.6

How To Reproduce

We added the following config block to the next.config.js file:

const withPWA = require('next-pwa')({
  dest: 'public',
  sw: '_next_service-worker.js',
  swSrc: 'service-worker.js',
  register: true,
  skipWaiting: true,
  maximumFileSizeToCacheInBytes: 3000000,
  disable: process.env.NODE_ENV === 'development',
  buildExcludes: ['app-build-manifest.json']
});
  1. Run next build
  2. Run git add public/_next_service-worker.js
  3. Run next build again (no other files in repo have been modified)

EXPECTED: git status contains no diffs, output file is identical to previous one
ACTUAL: git status contains diffs, a very big compressed line has changed in the service worker output

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions