PHPackages                             passchn/cakephp-vite - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. passchn/cakephp-vite

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

passchn/cakephp-vite
====================

ViteJS plugin for CakePHP

v2.4.0(2y ago)2220.8k↓33.3%6[3 issues](https://github.com/brandcom/cakephp-vite/issues)[3 PRs](https://github.com/brandcom/cakephp-vite/pulls)1MITPHPPHP &gt;=8.1

Since Jan 20Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/brandcom/cakephp-vite)[ Packagist](https://packagist.org/packages/passchn/cakephp-vite)[ RSS](/packages/passchn-cakephp-vite/feed)WikiDiscussions cake5 Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (35)Used By (1)

ViteHelper plugin for CakePHP 5
===============================

[](#vitehelper-plugin-for-cakephp-5)

The plugin provides a Helper Class for CakePHP to facilitate the use of [Vite JS](https://vitejs.dev/).

When running the Vite dev server, the Helper provides the right script tags for hot module replacement and page reloading.

In production mode, the Helper loads the bundled files. `@vitejs/plugin-legacy` is supported, which will insert `nomodule`-tags for older browsers, e.g. older iOS devices, which do not support js modules.

> This readme is for **version 1.x.** If you are migrating from 0.x and something is unclear, read the Migration guide under `/docs`. Feel free to open an issue if you run into problems.

Installation
------------

[](#installation)

You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).

### CakePHP Version Map

[](#cakephp-version-map)

CakePHP versionPlugin VersionBranchmin. PHP Version^3.10/cake3^7.4^4.20.xmaster^7.4^4.21.xmaster^8.0^5.02.xcake5^8.1The recommended way to install the plugin is:

```
composer require passchn/cakephp-vite
```

Load the plugin in your Application.php:

```
bin/cake plugin load ViteHelper
```

Load the Helper in your AppView.php:

```
$this->loadHelper('ViteHelper.ViteScripts');
```

Usage
-----

[](#usage)

In your php-layout, include this in your html head:

```
