Registry / devops / vite-plugin-mix

vite-plugin-mix

JSON →
library0.4.0jsnpmunverified

vite-plugin-mix (v0.4.0) adds a backend API server to your Vite dev server by running a separate process (e.g., PHP, Python, Node) alongside Vite's proxy. Unlike other solutions that require full-stack frameworks or custom middleware, it provides a simple plugin-based approach for mixing Vite with any backend language. It is actively maintained with monthly releases and ships TypeScript definitions. Peer dependency on Vite ^3.0.0.

npm install vite-plugin-mix
INSTALL
IMPORT
SIG · VITE-PLUGIN-MIX
V
vite-plugin-mix
devopsjavascriptv0.4.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mix
✓ import mix from 'vite-plugin-mix'
✗ const mix = require('vite-plugin-mix')
ESM-only; TypeScript types included.
default
✓ import mix from 'vite-plugin-mix'
✗ import { mix } from 'vite-plugin-mix'
Package uses default export, not named export.
type definitions
✓ import type { MixConfig } from 'vite-plugin-mix'
For TypeScript projects, you can import types for configuration.

Configure Vite to run a PHP backend on port 3001 via vite-plugin-mix.

import { defineConfig } from 'vite'; import mix from 'vite-plugin-mix'; export default defineConfig({ plugins: [ mix({ handler: './api/handler.php', port: 3001, }), ], });
Debug
Known issues
breakingvite-plugin-mix requires Vite 3.x; will not work with Vite 2.x or Vite 4+.
fix
Upgrade to Vite 3 or use older plugin version compatible with your Vite version.
affects: >=0.3.0 <0.4.0
gotchaThe handler script (PHP/Python/Node) must be executable and accessible; the plugin does not automatically set up the environment.
fix
Ensure your backend script is properly configured and has necessary dependencies installed.
affects: >=0.0.0
deprecatedOlder versions used a different configuration API (e.g., 'backend' option).
fix
Update to v0.3.0+ and use the 'handler' and 'port' options.
affects: <0.3.0
Errors
Common errors & fixes
Error: Cannot find module 'vite-plugin-mix'
Package is not installed or wrong import path.
fix
Run npm install vite-plugin-mix@latest and use correct import.
Error: The plugin requires vite@^3.0.0 to be installed
Vite version mismatch (e.g., using Vite 4).
fix
Install Vite 3.x: npm install vite@^3.0.0
TypeError: mix is not a function
Wrong import style (named instead of default).
fix
Use import mix from 'vite-plugin-mix' (default import).
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
viterequiredpeer dependency: works with Vite 3.x
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
vite-plugin-mix — npm install vite-plugin-mix · libregistry