Skip to content

Installation & Requirements

  • PHP: 8.2 or higher
  • ProcessWire: 3.0.210 or higher
  • First-Party Module Dependencies: None (Vite is a standalone foundational module)
  • Node.js Toolchain: Node 20+ and Vite 5+ (or 6+ / 7+) for compiling frontend assets
  1. Require the package from your project root:

    Terminal window
    composer require trk/processwire-vite
  2. Refresh and install the module via processwire-console (or Modules -> Refresh in Admin):

    Terminal window
    php vendor/bin/wire module:refresh
    php vendor/bin/wire module:install Vite

Once installed, Vite registers $this->wire()->vite (and the global vite() helper function when functions.php is loaded). Open Modules -> Configure -> Vite or add a setting('vite', [...]) array in site/config.php to align rootPath, rootUrl, buildDirectory, and hotFile with your vite.config.ts.

Setting Default Purpose
rootPath $config->paths->templates Absolute filesystem base directory containing hotFile and buildDirectory.
rootUrl $config->urls->templates Public base URL prefix corresponding to rootPath.
buildDirectory 'build' Subdirectory under rootPath where Vite writes compiled production assets.
hotFile 'hot' Filename (or relative path under rootPath) written by the Vite dev server while running.
manifest 'manifest.json' Manifest filename checked at {buildDirectory}/{manifest} and {buildDirectory}/.vite/{manifest}.
integrity 'integrity' Manifest key name containing SRI hashes, or false to disable SRI output.
nonce null Optional default CSP nonce string applied to emitted <script> and <link> tags.

Next steps