Skip to content

Vite for ProcessWire

Vite (trk/processwire-vite) is the standalone frontend asset integration layer for ProcessWire 3. It connects your templates and modules to the Vite dev server for instant Hot Module Replacement (HMR) in development, and resolves hashed production bundles, transitive CSS imports, and <link rel="modulepreload"> hints from Vite manifests in production.

Zero-Config Dev HMR

Automatically detects Vite’s hot file in development and injects @vite/client plus dev server <script type="module"> tags, with optional React Fast Refresh via withReactRefresh().

Recursive Manifest Resolution

Reads both Vite 4 (build/manifest.json) and Vite 5+ (build/.vite/manifest.json) manifests, walking transitive chunk imports and css arrays with built-in cycle protection.

SRI & CSP Nonce Ready

Attach Content Security Policy nonces via useNonce() and emit Subresource Integrity (integrity + crossorigin) attributes automatically when your manifest includes integrity hashes.

Multi-Build & Per-Page Isolation

Clone immutable instances with copy() to serve independent frontend, admin, or companion module builds from separate buildDirectory and hotFile paths without global state collisions.

Requirement Minimum Version Notes
PHP 8.2+ Uses strict types and modern PHP syntax.
ProcessWire 3.0.210+ Standalone module with zero first-party module dependencies; exposes $this->wire()->vite and the vite() helper.
Node.js & Vite Node 20+, Vite 5+ / 6+ / 7+ Any Vite setup that writes a standard manifest and optional hot file.
Admin UI None (Headless Service) Configured via Modules -> Configure -> Vite or setting('vite', [...]) in site/config.php.

Next steps