Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
elliot-nelson opened this issue Jan 10, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@elliot-nelson
Copy link

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

@elliot-nelson elliot-nelson added the bug Something isn't working label Jan 10, 2024
@elliot-nelson elliot-nelson changed the title Service worker gets changed every build Service worker gets changed every build (output not reproducible) Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant