Smeltery
Get started

Alloy

v0.1

Vite

The kits build the JavaScript with Vite. Their vite.config.ts has a small smeltery() plugin: it builds into public/build/ with public/build/manifest.json, and while the dev server runs (on 127.0.0.1:5173) it writes its URL to storage/framework/vite.hot.

  • Dev server: in debug builds, while storage/framework/vite.hot exists, @vite loads the dev server's client and the entries from it (hot reloading). Release builds never read this file, and neither does any build under APP_ENV=production. Only an http(s) URL on 127.0.0.1, localhost or [::1] is used; any other content is ignored, with one warning in the log.
  • Build: with public/build/manifest.json, @vite writes the entries' CSS links, modulepreload links for the chunks they import, and their scripts, under /build/. Release builds read the manifest once; debug builds read it again when it changes.
  • Neither: a template error in debug builds ("No Vite assets"), nothing under APP_ENV=testing (so cargo test needs no Node.js), and nothing in release builds, which log an error when the server starts.

smeltery serve logs where the assets come from when the server starts (console commands such as migrate do not). The asset version is the first 32 hex characters of the SHA-256 of public/build/manifest.json, "" without one or while the dev server runs (.version(f) sets another). An Inertia GET whose X-Inertia-Version differs gets 409 with X-Inertia-Location before its handler runs (the flash is kept for the next request), so the browser loads the new build after a deploy.

↑↓ moveEnter openEsc close