Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How to Resolve Browser Cache Invalidation Issue in Vite-React Project Deployment? #17540

Closed
7 tasks done
ameeetgaikwad opened this issue Jun 21, 2024 · 0 comments
Closed
7 tasks done

Comments

@ameeetgaikwad
Copy link

ameeetgaikwad commented Jun 21, 2024

Describe the bug

Encountering a persistent issue with my Vite-React project deployment. Whenever I deploy a new version, the changes are not reflected on the production URL. Instead, they only appear after performing a hard reload. This seems to be a cache-related problem.

Details: I have a Vite-React project deployed in a production environment. However, whenever I push updates and redeploy the application, users visiting the site often don't see the latest changes until they perform a hard reload (Ctrl + Shift + R or Cmd + Shift + R). This indicates that there's a caching issue preventing the new version from being fetched and displayed immediately.

Also when the hard reload is done, and after that i again visit the website I again see the old website, the new changes disappears again.

Config:
app.tsx
registerServiceWorker.js
sw.js
vercel.json
vite.config.ts

Reproduction

Steps to reproduce

When u visit the website for the first time and when and update is made to the website you will face the issue from next time you visit the website.

System Info

System:
    OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (12) x64 AMD Ryzen 5 4600H with Radeon Graphics
    Memory: 5.08 GB / 14.99 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v18.19.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
    pnpm: 8.15.1 - ~/.local/share/pnpm/pnpm
    bun: 1.0.35 - ~/.nvm/versions/node/v18.19.0/bin/bun
  Browsers:
    Brave Browser: 124.1.65.126
  npmPackages:
    @vitejs/plugin-react: ^4.2.1 => 4.2.1 
    vite: ^5.2.7 => 5.2.10

Used Package Manager

bun

Logs

No response

Validations

@vitejs vitejs locked and limited conversation to collaborators Jun 24, 2024
@bluwy bluwy converted this issue into discussion #17556 Jun 24, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

1 participant