Starts a local development server with Vite’s fast HMR (Hot Module Replacement).Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/vinext/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Options
Port to listen on. Can also use the short form
-p.Hostname to bind to. Can also use the short form Use
-H.0.0.0.0 to expose the server on your local network.Accepted for compatibility with Next.js. No-op (Vite is always used).
Show help for this command. Can also use
-h.Behavior
Router Detection
vinext automatically detects your router type:- App Router: Detects
app/orsrc/app/directory - Pages Router: Detects
pages/orsrc/pages/directory (when noapp/exists)
Vite Integration
vinext runs Vite’s dev server under the hood with these features:- Fast cold start: No bundling required, uses native ESM
- Instant HMR: Changes reflect immediately without full reload
- Optimized dependencies: Pre-bundles dependencies with esbuild
- Module deduplication: Prevents “Invalid hook call” errors by deduplicating React packages
Configuration Loading
The dev server loads configuration in this order:- User’s
vite.config.ts: If present, uses your custom config - Auto-configuration: If no config file exists, vinext generates one automatically:
- Registers
vinext()plugin - Auto-detects and registers
@vitejs/plugin-rscfor App Router - Sets up React deduplication
- Registers
Module Resolution
vinext dynamically resolves Vite from your project’snode_modules, not from vinext’s installation directory. This prevents dual Vite instances when using npm link or bun link for local development.
Examples
Basic Usage
Start dev server on default port (3000):Custom Port
Start dev server on port 4000:Expose on Local Network
Make the dev server accessible from other devices on your network:Custom Port and Hostname
Combine options:Using with npm Scripts
Add to yourpackage.json:
Configuration File
Automatic Configuration (Recommended)
If you don’t have avite.config.ts, vinext auto-configures everything:
Custom Configuration
Create avite.config.ts for custom setups:
Development Features
Hot Module Replacement (HMR)
vinext provides instant HMR for:- Client Components: Full React Fast Refresh support
- Server Components (App Router): Selective updates without full page reload
- Styles: CSS/SCSS changes apply instantly
- Static assets: Image/font changes reflect immediately
TypeScript
vinext fully supports TypeScript with no additional configuration:Environment Variables
Access environment variables in your code:.env.local:
Troubleshooting
Port Already in Use
If port 3000 is already in use:Module Not Found Errors
If you see “Module not found” errors, ensure dependencies are installed:@vitejs/plugin-rsc is installed:
Invalid Hook Call Error
This usually indicates duplicate React instances. vinext automatically deduplicates React, but if you still see this error:-
Clear node_modules and reinstall:
-
If using
npm link, ensure you’re resolving React from the project:
Performance
vinext dev server is significantly faster than Next.js:- Cold start: 2-3x faster (no bundling required)
- HMR: 10-50x faster (native ESM vs webpack HMR)
- Memory usage: Lower (no webpack compilation overhead)
Next Steps
build Command
Build your app for production
Configuration
Configure vinext with vite.config.ts