bundle exec rails s -p 3000
s is short for server and -p defines the port (e.g., 3000).
yarn dev --host
Run this in a separate terminal. Because "dev": "vite" is in package.json, this command starts the Vite server. --host makes it accessible over local network.
In _bundle.html.erb, set condition to false, so that second block will execute:
<% if false %>
...
<% else %>
<%= stylesheet_link_tag "#{entrypoint}", media: "all" %>
<%= javascript_include_tag "#{entrypoint}", type: "module", crossorigin: "anonymous" %>
<% end %>
Then run:
yarn build
Restart Vite server after build.
Restore the condition to:
Rails.env.development? || Rails.env.test?
bundle exec rails s -p 3000