Open dmix opened 1 year ago
Hi Daniel!
Based on the example you provided, and assuming you are configuring asset_host
in Rails, you might want to check the build output to verify that it's not printing this error the first time.
To discard whether this is the problem, I'd suggest explicitly configuring VITE_RUBY_ASSET_HOST
, and see whether that prevents the problem.
Vite Rails will attempt to load the Rails app before building, in order to access the action_controller.asset_host
as configured in the current environment (RAILS_ENV
).
Description 📖
I originally posted an issue on the vite repo (https://github.com/vitejs/vite/issues/13071) but upon further investigation I think it might be more relevant here.
We recently tried deploying our Rails7 + Vue 3 + Vite 4.2.0 (from Vite 2.9) update and since we have multiple app servers we noticed that when Capistrano ran precompile it generated two different hashes on different servers (and only two).
I reproduced this locally so it's not just an issue with our servers.
The difference between the files:
It seems the first one
8f133cfb
happened after the first build but re-runningbundle exec vite build --force
multiple times continually produced06ecfed2
(with the proper CDN path).Any ideas on why it might not be inserting the CDN the first time around?
We're attempting to try Vite 4.3.4 at the moment to see if it helps...
System info
package.json:
Gemfile.lock