Usage with vite
While you can use any js bundler you want with Superglue. Vite has conveniences that make working with Superglue easier.
To get started, go ahead and follow the instructions to install vite_rails
Next move your app/javascript/entrypoints/application.jsx
file to app/javascript/entrypoints/application.jsx
and update the references.
!!! info When using Superglue's installation generator, a app/javascript/application.jsx
gets generated. vite_rails
expects this to be put in an entrypoints
folder. If you're installing vite_rails
after superglue's installation, the is set by vite_rails
to be app/javascript/entrypoints
.
Migrate your @views
, @javascript
aliases to vite.config.mts
Make sure you're using vite_javascript_tag
in your layout, application.html.erb
.
And finally, one of the more manual process of using superglue is the manual build of your page_to_page_mapping.js
file. We can improve the developer experience by removing that step by using this snippet:
Last updated
Was this helpful?