vite-hyper-config
raw JSON → 0.9.0 verified Mon Apr 27 auth: no javascript
This package enables running Vite's own configuration (vite.config.ts) through Vite itself, allowing transformation and execution of the config file with the same tool it configures. Currently at v0.9.0, it supports Vite versions 4 through 8 as peer dependencies, requires Node.js >=20.19.0, and is released frequently (multiple versions per month). Key differentiator: it uses Vite to process its own config, enabling advanced plugin-based config transformations and dependency inlining that normal Vite config loading cannot achieve.
Common errors
error ERR_REQUIRE_ESM: require() of ES Module not supported ↓
cause Cannot require('vite-hyper-config') because the package is ESM-only.
fix
Change to ESM import: import { startVite } from 'vite-hyper-config'
error TypeError: startVite is not a function ↓
cause Using default import when only named export exists.
fix
Use named import: import { startVite } from 'vite-hyper-config'
error The engine 'node' is incompatible with this module. ↓
cause Installed Node.js version is below 20.19.0.
fix
Update Node.js to version >=20.19.0
error Cannot find module 'vite' ↓
cause Vite is not installed as a dependency.
fix
Install vite: npm i vite
Warnings
breaking Node.js >=20.19.0 is required; earlier versions will throw unsupported engine errors. ↓
fix Update Node.js to version 20.19.0 or later.
breaking The package is ESM-only and cannot be imported via CommonJS require(). ↓
fix Use ESM imports or set type: 'module' in package.json.
gotcha startVite is a named export, not a default export. Using default import yields undefined. ↓
fix Use import { startVite } from 'vite-hyper-config'.
breaking Peer dependency vite must be version 4, 5, 6, 7, or 8. Using unsupported versions will cause runtime errors. ↓
fix Ensure your project has a compatible version of vite installed.
deprecated The configuration options for startVite may change in future versions; check migration notes when upgrading. ↓
fix Always refer to the latest documentation when upgrading.
Install
npm install vite-hyper-config yarn add vite-hyper-config pnpm add vite-hyper-config Imports
- startVite wrong
const startVite = require('vite-hyper-config')correctimport { startVite } from 'vite-hyper-config' - startVite wrong
import startVite from 'vite-hyper-config'correctimport { startVite } from 'vite-hyper-config' - type RunnerOptions wrong
import { RunnerOptions } from 'vite-hyper-config'correctimport type { RunnerOptions } from 'vite-hyper-config'
Quickstart
import { startVite } from 'vite-hyper-config'
import { defineConfig } from 'vite'
// Run Vite with self-transforming config
startVite(
{
plugins: [/* plugins for your app */]
},
{
// Config for transforming vite.config.ts
plugins: []
},
{
deps: {
inline: ['@vitejs/plugin-vue']
}
}
)