PHPackages                             wp-spaghetti/wp-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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. wp-spaghetti/wp-vite

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

wp-spaghetti/wp-vite
====================

A powerful Vite integration service for WordPress with Docker support, obfuscated assets handling, cache busting, and comprehensive logging

v1.1.4(8mo ago)0303[1 PRs](https://github.com/wp-spaghetti/wp-vite/pulls)GPL-3.0-or-laterPHPPHP &gt;=8.0CI passing

Since Sep 3Pushed 1mo agoCompare

[ Source](https://github.com/wp-spaghetti/wp-vite)[ Packagist](https://packagist.org/packages/wp-spaghetti/wp-vite)[ Docs](https://github.com/wp-spaghetti/wp-vite)[ Fund](https://buymeacoff.ee/frugan)[ RSS](/packages/wp-spaghetti-wp-vite/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (12)Versions (10)Used By (0)

[![PHP Version](https://camo.githubusercontent.com/d6a621e8d5f879cc8110260233f0d9a9bc6cbde6ca22747ce0836d0effb9f395/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f77702d7370616768657474692f77702d76697465)](https://camo.githubusercontent.com/d6a621e8d5f879cc8110260233f0d9a9bc6cbde6ca22747ce0836d0effb9f395/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f77702d7370616768657474692f77702d76697465)[![Packagist Downloads](https://camo.githubusercontent.com/9cee0731b2285f0591b640b6dde6d2ad93533c864a808c630b6302a20721828c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77702d7370616768657474692f77702d76697465)](https://camo.githubusercontent.com/9cee0731b2285f0591b640b6dde6d2ad93533c864a808c630b6302a20721828c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77702d7370616768657474692f77702d76697465)[![Packagist Stars](https://camo.githubusercontent.com/b5a5c44917c9082993487842f1171f7034b18ef3cd77a8bcc3059debb68b0a67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f77702d7370616768657474692f77702d76697465)](https://camo.githubusercontent.com/b5a5c44917c9082993487842f1171f7034b18ef3cd77a8bcc3059debb68b0a67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f77702d7370616768657474692f77702d76697465)[![GitHub Actions Workflow Status](https://github.com/wp-spaghetti/wp-vite/actions/workflows/main.yml/badge.svg)](https://github.com/wp-spaghetti/wp-vite/actions/workflows/main.yml/badge.svg)[![Coverage Status](https://camo.githubusercontent.com/ec54a1173907d28656cf7c7a771ad81694d9b912c9d1c05448adce0d36be18fa/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f77702d7370616768657474692f77702d76697465)](https://camo.githubusercontent.com/ec54a1173907d28656cf7c7a771ad81694d9b912c9d1c05448adce0d36be18fa/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f77702d7370616768657474692f77702d76697465)[![Known Vulnerabilities](https://camo.githubusercontent.com/1d1e34e645a5758d4b90f618bc0419fcac49aead5c2dfc1b1b4aea33a090cc8a/68747470733a2f2f736e796b2e696f2f746573742f6769746875622f77702d7370616768657474692f77702d766974652f62616467652e737667)](https://camo.githubusercontent.com/1d1e34e645a5758d4b90f618bc0419fcac49aead5c2dfc1b1b4aea33a090cc8a/68747470733a2f2f736e796b2e696f2f746573742f6769746875622f77702d7370616768657474692f77702d766974652f62616467652e737667)[![GitHub Issues](https://camo.githubusercontent.com/8658787918c992c05d413845b5a0db7e1019eac3348ae0b52eff576cbd263db4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f77702d7370616768657474692f77702d76697465)](https://camo.githubusercontent.com/8658787918c992c05d413845b5a0db7e1019eac3348ae0b52eff576cbd263db4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f77702d7370616768657474692f77702d76697465)[![GitHub Release](https://camo.githubusercontent.com/94a030467325a8d36710b54ce828a4f4ef8367c405a0fdcdba3944803f0f6a8e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f77702d7370616768657474692f77702d76697465)](https://camo.githubusercontent.com/94a030467325a8d36710b54ce828a4f4ef8367c405a0fdcdba3944803f0f6a8e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f77702d7370616768657474692f77702d76697465)[![License](https://camo.githubusercontent.com/7a3356c2c58dec3855c7d6e99d9043e9dec945f01153ccea2d76cbb2e92fa50f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f77702d7370616768657474692f77702d76697465)](https://camo.githubusercontent.com/7a3356c2c58dec3855c7d6e99d9043e9dec945f01153ccea2d76cbb2e92fa50f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f77702d7370616768657474692f77702d76697465)

Wp Vite
=======

[](#wp-vite)

A powerful Vite integration service for WordPress with enhanced Docker support, obfuscated assets handling, flexible cache busting, and comprehensive logging.

Features
--------

[](#features)

- **Docker Compatibility**: Automatic Docker environment detection with flexible server/HMR configuration
- **Hot Module Replacement (HMR)**: Full support for Vite's HMR with configurable hosts and ports
- **Obfuscated Assets Support**: Built-in handling for obfuscated JavaScript and CSS files (`.obf.js`, `.min.obf.css`)
- **Smart Asset Detection**: Automatic file discovery with priority-based pattern matching
- **Cache Busting**: Timestamp-based cache busting for production assets
- **Development/Production Modes**: Seamless switching between Vite dev server and compiled assets
- **Multiple File Extensions**: Support for JS, TS, JSX, TSX, CSS, SCSS, SASS
- **Subdirectory Support**: Organize assets in subdirectories with automatic detection
- **Extension Auto-Detection**: No need to specify file extensions - Wp Vite finds the right file automatically
- **Manifest Integration**: Full Vite manifest.json support for optimized production builds
- **Environment Management**: Built-in support for WordPress constants and .env files via [WP Env](https://github.com/wp-spaghetti/wp-env)
- **Comprehensive Logging system**: PSR-3 compatible logging with [WP Logger](https://github.com/wp-spaghetti/wp-logger) integration and optional [Wonolog](https://github.com/inpsyde/Wonolog) support
- **Zero External Dependencies**: Works with or without optional logging libraries, with automatic fallback to native file-based logging

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

[](#installation)

Install via Composer:

```
composer require wp-spaghetti/wp-vite
```

Quick Start
-----------

[](#quick-start)

### 1. Initialize Wp Vite

[](#1-initialize-wp-vite)

In your plugin or theme, initialize Wp Vite with your base paths:

```
