vite-plugin-pwa incompatible with tanstack start production builds
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Which project does this relate to?
Start
Describe the bug
vite-plugin-pwa's build steps (generate assets, generate serviceworker bundle) are seemingly not executed when running vite build with VitePWA() and tanstackStart() both present.
This is likely because to vite-plugin-pwa not having proper support for the Vite 6 environment API.
There is an open PR to solve this: https://github.com/vite-pwa/vite-plugin-pwa/pull/786, however the current state of this PR has the same issue as the stable version of the package.
No PWA/SW steps are ran in build:
but it works in the vite dev server:
Your Example Website or App
https://stackblitz.com/edit/github-djpcrmc9?file=src%2Frouter.tsx
Steps to Reproduce the Bug or Issue
npm installnpm run build- No PWA/SW steps are ran in build:
Expected behavior
- Build steps actually run during
vite build - Service worker gets built into tanstack start's
client-dist, so it can also get picked up by nitropublicAssets[] - Any script injection steps such as into also work(?)
Screenshots or Videos
No response
Platform
- Start Version: ^1.131.7
- OS: macOS, Stackblitz WebContainer
- Browser: Chrome
- Browser Version: 139.0.7258.66
- Bundler: Vite
- Bundler Version: ^6.3.5
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz example, especially src/router.tsx, and run npm install followed by npm run build. Compare the VitePWA() and tanstackStart() build behavior under Vite 6, including the expected service worker output in client-dist and Nitro publicAssets[]. Done means the PWA build and injection steps run during vite build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100