Comments (9)
Good timing, I have something in the vite-5
branch, testing before releasing the gems.
from vite_ruby.
@ElMassimo You are right that the assets are preserved between deployments, a common practice with Capistrano in order to speed up deployment times. However, I feel that documentation may not be enough in this case. We didn't encounter any issues in development before we rolled out the change, so I imagine most people would not check Troubleshooting until it is already too late.
I think merging the old and the new should be considered incorrect behaviour. Perhaps a better approach may be to check the for presence of the manifests under .vite and use only those, otherwise fall back to the old manifests.
def known_manifest_paths
manifest_files = [
# NOTE: Generated by Vite when `manifest: true`, which vite-plugin-ruby enables.
'manifest.json',
# NOTE: Path where vite-plugin-ruby outputs the assets manifest file.
'manifest-assets.json',
]
vite5_manifest_paths = manifest_files.map { |path|
build_output_dir.join(".vite/#{path}")
}
vite4_manifest_paths = manifest_files.map { |path|
build_output_dir.join(path)
}
if vite5_manifest_paths.any? { |path| File.exists?(path) }
vite5_manifest_paths
else
vite4_manifest_paths
end
end
from vite_ruby.
@ElMassimo Here is a PR for the above suggested change. It seems to be working well on our deployments.
https://github.com/ElMassimo/vite_ruby/pull/432/files
from vite_ruby.
Closed in #421. Releasing a new version of vite_ruby
soon.
from vite_ruby.
@ElMassimo We just run into an issue while upgrading from Vite 4 to Vite 5. After upgrade and deploy, we ended up with this file structure:
public/
vite/
manifest-assets.json
manifest.json
.vite/
manifest-assets.json
manifest.json
After the application rebooted, it was still loading the old JS assets from public/vite/manifest*. I had to SSH in, remove those old manifest files, restart the application server, then things came right. Is this expected? From what I can see of the commit, it should default to V5 manifest but doesn't appear to be working.
from vite_ruby.
After update to latest vite_rails
manifest.json location has been changed and Rails fails to pickup new manifest. Is there is a workaround for this? I'm using Capistrano to deploy the app.
I have to do assets:clobber
, assets:precompile
and the restart server in order for Rails to pick up the latest build.
from vite_ruby.
You can configure assets_manifests
to backup the new location, or configure Vite to output the manifest in the old location.
from vite_ruby.
Thanks! I was able to fix this issue by cleaning shared/public
directory in Capistrano and adding public/vite
to linked_dirs
.
from vite_ruby.
Hi Kieran! In that case, it would load all four manifest files, unfortunately merging the old ones last since the new location is read first.
This problem would only happen when preserving assets from previous deployments (as opposed to when using containers).
Flipping the order would potentially avoid this problem during upgrades, but since it's a one-time thing I'm leaning towards documenting it in Troubleshooting instead.
from vite_ruby.
Related Issues (20)
- Configurable option for location of vite.config.ts HOT 2
- Update rack-proxy to at least 0.7.5 HOT 2
- resolve_entries is slow when using vite_javascript_tag for very large and complex tsx react/relay files HOT 2
- `An import map is added after module script load was triggered` in console. HOT 4
- Fail to load styles from js files when it conflicts with stylesheet tag
- plugin_legacy is not working as expected
- Allow `.` as a valid option for `sourceCodeDir`
- 'conflicting chdir during another chdir block' calling vite_asset_path
- Can't find SVG file in manifest after upgrade to 3.5.0 HOT 2
- "The CJS build of Vite's Node API is deprecated." HOT 4
- Disabling cssCodeSplit breaks CSS file location used by tag helper in Rails HOT 1
- vite-rails live demo on Heroku is broken HOT 2
- clean command not detecting versions properly HOT 1
- Calling `bin/vite ssr` just exits with no errors
- vite_hanami in hanami 2.1 HOT 1
- vite.config.ts base: './' not applied
- How can I enable HMR to function with subdomains? HOT 1
- `npm bin` is removed in newer versions of NPM
- Heap Out Of Memory - Build failed for staging environment on a Rails App
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite_ruby.