Closed KevinBerthier closed 2 months ago
After further investigations, we found that assets:clean
was flaky because the method #versions uses mtime to determine versions, but sometimes a deployment can spread on multiples mtimes/versions (3 in our case).
Our temporary solution was to increase keep_assets
Sprocket seems to clean assets the same manner but seems to be able to generate all assets with an identical mtime
Hi Kevin! Thanks for reporting.
It seems like files in a Vite build have a different mtime
, so the vite:clean
task should be modified to cluster files within the time span that a build typically requires (modified 5 minutes apart should cover most cases).
PRs are welcome!
Description 📖
Some assets are missing on production after deployment. It happens totally randomly. A redeployment fixes the issue
Reproduction 🐞
deploy.rb
vite.config.ts
Vite Ruby Info
``` bin/vite present?: true vite_ruby: 3.3.4 vite_rails: 3.0.15 rails: 7.0.7.2 node: v20.5.1 npm: 9.8.0 yarn: 1.22.17 pnpm: ruby: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin22] installed packages: graphiste@0.1.0 /Users/kevinberthier/code/KevinBerthier/graphiste ├─┬ @vitejs/plugin-legacy@3.0.2 │ └── vite@4.4.9 deduped ├─┬ @vitejs/plugin-vue@4.2.3 │ └── vite@4.4.9 deduped ├─┬ vite-plugin-rails@0.1.0 │ ├─┬ vite-plugin-environment@1.1.3 │ │ └── vite@4.4.9 deduped │ ├─┬ vite-plugin-full-reload@1.0.5 │ │ └── vite@4.4.9 deduped │ ├─┬ vite-plugin-ruby@3.1.3 │ │ └── vite@4.4.9 deduped │ └── vite@4.4.9 deduped ├─┬ vite-plugin-ruby@3.2.2 │ └── vite@4.4.9 deduped └── vite@4.4.9 ```