Using the generator

In Version 9 of this gem, the file vite-ssr.config.ts has changed.

There is a generator:

rails g svelte_on_rails:update

it will ask you for every step if it should be done.

Precompile Svelte files

After all it precompiles the svelte files. By this, it copies the render.js file into the assets folder which is needed for rendering.

On updating, you may need to do some rewritings of the svelte files and it is handy to check if the precompilation works. For this, you can run:

npm run build:ssr

And check for warnings and errors.


Copyright © 2025-2027 sedlmair.ch. Distributed by MIT license.