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

caching and serving a previous version #15409

Closed
7 tasks done
j2l opened this issue Dec 22, 2023 · 5 comments
Closed
7 tasks done

caching and serving a previous version #15409

j2l opened this issue Dec 22, 2023 · 5 comments

Comments

@j2l
Copy link

j2l commented Dec 22, 2023

Describe the bug

Using svelte, npm run dev (vite), I stumbled on a weird case where I have an error about a variable I used (hierarchy2), that doesn't exist anymore in App.svelte since a few version iterations:
image
image

I tried with another fresh browser and have the same issue, so it's not the browser cache.
I also tried by changing the file name (App.svelte) to something else and call it in main.ts, it didn't fix it.
An also tried vite --force, npm cache clean --force without luck.

Is there a cache in vite? How to clear it?
Or is it elsewhere?

Reproduction

impossible

Steps to reproduce

No response

System Info

System:
    OS: Linux 6.6 Pop!_OS 22.04 LTS
    CPU: (12) x64 Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
    Memory: 8.04 GB / 15.43 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.17.1 - /usr/bin/node
    Yarn: 1.22.19 - ~/n/bin/yarn
    npm: 9.6.7 - /usr/bin/npm
    bun: 1.0.1 - ~/.bun/bin/bun
  Browsers:
    Chrome: 120.0.6099.129
    Chromium
    Firefox
  npmPackages:
    vite: ^4.2.0 => 4.5.1

Used Package Manager

npm

Logs

No response

Validations

Copy link

Hello @j2l. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@bluwy
Copy link
Member

bluwy commented Dec 27, 2023

I've seen this happening before when switching between Vite projects, and I haven't really figured out why it happens, but if we want to keep an issue to track this behaviour, it should have a reproduction so others can try to fix this too.

@j2l
Copy link
Author

j2l commented Dec 27, 2023

I understand, but since I have no idea how this can happen, and there are so many pieces in movement, I can't make it reproductible.
All I was asking is if there's a cache somewhere you know about and is not documented, or some experiment I can try.
Of course, I will simply copy paste my App.svelte in a fresh project and it should work. But since it is still an issue each time I run npm run dev, I may try some stuff to track it down.

@bluwy
Copy link
Member

bluwy commented Dec 27, 2023

There is no cache in Vite that would explicitly trigger this. Except my only hunch is the browser's cache of certain modules that triggered it to fetch old modules, though Vite isn't setting any cache headers for source files to cause that. Plus, Vite respects the etag so only files that matches the transformed content in the new app is used. It definitely looks like a caching issue though, but afaik isn't something Vite does intentionally.

@j2l
Copy link
Author

j2l commented Dec 27, 2023

thank you @bluwy
OK, so I have to search elsewhere.
I double checked, and cache is already disabled (Firefox > Network > Disable Cache). I don't see any other way, beside CTRL+SHIFT+R which I do.
I don't have any clue what is happening.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 31, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants