Skip to main content
Starts a local development server with Vite’s fast HMR (Hot Module Replacement).

Usage

Options

number
default:"3000"
Port to listen on. Can also use the short form -p.
string
default:"localhost"
Hostname to bind to. Can also use the short form -H.
Use 0.0.0.0 to expose the server on your local network.
flag
Accepted for compatibility with Next.js. No-op (Vite is always used).
flag
Show help for this command. Can also use -h.

Behavior

Router Detection

vinext automatically detects your router type:
  • App Router: Detects app/ or src/app/ directory
  • Pages Router: Detects pages/ or src/pages/ directory (when no app/ exists)
The dev server behavior differs based on router:

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:
  1. User’s vite.config.ts: If present, uses your custom config
  2. Auto-configuration: If no config file exists, vinext generates one automatically:
    • Registers vinext() plugin
    • Auto-detects and registers @vitejs/plugin-rsc for App Router
    • Sets up React deduplication

Module Resolution

vinext dynamically resolves Vite from your project’s node_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):
Output:

Custom Port

Start dev server on port 4000:
Or using the short form:

Expose on Local Network

Make the dev server accessible from other devices on your network:
Output:

Custom Port and Hostname

Combine options:
Short form:

Using with npm Scripts

Add to your package.json:
Then run:

Configuration File

If you don’t have a vite.config.ts, vinext auto-configures everything:

Custom Configuration

Create a vite.config.ts for custom setups:
If you have a vite.config.ts, vinext uses it instead of auto-configuration. Make sure to include the vinext() plugin.

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:
Load from .env.local:

Troubleshooting

Port Already in Use

If port 3000 is already in use:
Or stop the process using port 3000:

Module Not Found Errors

If you see “Module not found” errors, ensure dependencies are installed:
For App Router projects, ensure @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:
  1. Clear node_modules and reinstall:
  2. 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