Vite
final class Vite
Supports operations for Vite.
Constants
| DEFAULT_DEV_SERVER |
Fallback dev server URL used when no hot file is present. |
Methods
Extracts value of csrf_token from hidden element.
Absolute path to the "hot" file written by the chappyHot Vite plugin
while npm run dev is running. It contains the dev server's public URL.
Determines if the Vite dev server is running by checking for the hot file.
Returns the dev server URL without a trailing slash.
Dev check. Dev assets are used only when APP_ENV is a dev-like environment AND the Vite dev server is running (hot file exists).
Adds dev tags.
Locate and decode the Vite manifest.
Adds production tags.
Render script/link tags for a Vite entry.
Details
at line 16
static string
csrfToken()
Extracts value of csrf_token from hidden element.
at line 36
static string
hotFile()
Absolute path to the "hot" file written by the chappyHot Vite plugin
while npm run dev is running. It contains the dev server's public URL.
at line 46
static bool
isRunningHot()
Determines if the Vite dev server is running by checking for the hot file.
at line 58
static string
devServerUrl()
Returns the dev server URL without a trailing slash.
Resolution order: hot file contents, VITE_DEV_SERVER env variable, then DEFAULT_DEV_SERVER.
at line 76
static bool
isDev()
Dev check. Dev assets are used only when APP_ENV is a dev-like environment AND the Vite dev server is running (hot file exists).
Otherwise the built assets from the manifest are used.
at line 89
static bool
viteIsRunning(string|null $devBase = null)
deprecated
deprecated
Check if Vite dev server is reachable.
at line 104
static private string
devTags(string $entry, string $devServer)
Adds dev tags.
at line 120
static private array|null
loadManifest()
Locate and decode the Vite manifest.
at line 157
static private string
prodTags(string $entry)
Adds production tags.
at line 224
static string
tags(string $entry, string|null $devServer = null)
Render script/link tags for a Vite entry.
- In dev (env=local/dev & hot file present), inject HMR client + raw module URL.
- Otherwise use manifest-based assets.