feat(web): migrate PWA to Serwist#30808
Conversation
Summary of ChangesHello @hyoban, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes the application's Progressive Web App (PWA) capabilities by transitioning from the 'next-pwa' library to 'Serwist'. This change enhances the PWA's performance and reliability, particularly in offline scenarios, by leveraging Serwist's advanced service worker features and Next.js Turbopack integration. The update involves restructuring PWA-related code and optimizing dependencies to align with the new architecture. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully migrates the PWA implementation from next-pwa to Serwist. The changes are well-executed, including updating dependencies, removing the old next-pwa configuration, and setting up the new Serwist service worker and route. The new service worker implementation correctly preserves the existing caching strategies. I have identified a potential issue in the service worker route that could lead to a server crash if git is not available, and I've provided a suggestion to make it more robust. Additionally, I've suggested a minor refactoring in the service worker file to improve code readability by using constants for time durations.
There was a problem hiding this comment.
Pull request overview
This pull request migrates the PWA implementation from next-pwa to Serwist, a modern service worker library with better Next.js 15 and Turbopack support.
Changes:
- Replaced next-pwa with @serwist/turbopack for service worker generation and integration
- Removed Babel-related dependencies (@babel/core, babel-loader) that were only needed for next-pwa
- Implemented a custom service worker with runtime caching strategies using Serwist APIs
- Added a dedicated service worker route at
/serwist/[path]/route.tsfor dynamic service worker generation
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| web/pnpm-lock.yaml | Updated dependency lock file to reflect removal of next-pwa/babel packages and addition of Serwist packages |
| web/package.json | Removed next-pwa, @babel/core, babel-loader; added @serwist/turbopack, serwist, and esbuild-wasm |
| web/next.config.js | Removed withPWA wrapper and configuration; added esbuild-wasm to serverExternalPackages |
| web/knip.config.ts | Removed babel-loader from ignoreDependencies list |
| web/app/sw.ts | New service worker implementation with Serwist, including runtime caching strategies and offline fallback |
| web/app/serwist/[path]/route.ts | New route handler for serving the service worker with dynamic precache entries |
| web/app/layout.tsx | Integrated SerwistProvider wrapper around the app to register the service worker |
| web/app/components/provider/serwist.tsx | New client component that re-exports SerwistProvider from @serwist/turbopack |
Files not reviewed (1)
- web/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Testing
Fixes #30792