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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean command not detecting versions properly #438

Open
philippevezina opened this issue Mar 5, 2024 · 1 comment
Open

clean command not detecting versions properly #438

philippevezina opened this issue Mar 5, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@philippevezina
Copy link

Description 馃摉

vite_ruby uses the mtime as a reference to detect different versions of the app: https://github.com/ElMassimo/vite_ruby/blob/main/vite_ruby/lib/vite_ruby/commands.rb#L148 That being said, a single Vite build can generate files with more than one mtime. For example, vite-plugin-rails uses rollup-plugin-gzip at the end of the build which will write many files with different mtimes.

This causes files to delete unexpectedly when running bin/vite clean. It's possible this bug is hard to reproduce with a small project as all written files may end up having the same mtime.

Reproduction 馃悶

Vite Ruby Info
  • Run bin/rake vite:build on a big project with no currently built assets.
  • Run bin/rake vite:clean[1,0]

Result: files will be deleted while there is only a single version of the built assets.

@philippevezina philippevezina added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Mar 5, 2024
@ElMassimo ElMassimo added bug Something isn't working help wanted Extra attention is needed and removed bug: pending triage Something doesn't seem to be working, but hasn't been verified labels Mar 26, 2024
@ElMassimo
Copy link
Owner

Hi Philippe, thanks for reporting!

Fixing this will likely require grouping files by modified time using a certain range (maybe 5 minutes is a reasonable default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants