Registry / web-framework / vike
library0.4.258jsnpmunverified

Vike is a highly flexible and unopinionated Server-Side Rendering (SSR) framework, powered by Vite, designed to build advanced web applications. Unlike monolithic frameworks such as Next.js or Nuxt, Vike positions itself as a 'composable' alternative, allowing developers to integrate their preferred frontend libraries (React, Vue, Solid, Svelte, etc.) and dictate their own data fetching and routing strategies. The current stable version is `0.4.258`, reflecting active and continuous development. While its predecessor, `vite-plugin-ssr`, stabilized around `0.1.0` in 2021, the `vike` package continues to evolve with frequent releases, indicating a commitment to rapid iteration and improvement. Its core differentiator lies in providing the foundational tooling for SSR with Vite, empowering developers with choice and control rather than enforcing a rigid application structure, making it suitable for complex or highly customized projects.

npm install vike
INSTALL
IMPORT
SIG · VIKE
V
vike
web-frameworkjavascriptv0.4.258
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

vike
import vike from 'vike/plugin'
import { vike } from 'vike'
The Vike plugin is a default export from the 'vike/plugin' entry point and is used in your Vite configuration file.
PageContext
import type { PageContext } from 'vike/types'
import { PageContext } from 'vike/types'
This is a TypeScript type import for the `pageContext` object, providing full type safety for server-side and client-side page context data.
renderPage
import { renderPage } from 'vike/server'
import { renderPage } from 'vike'
Used programmatically on the server-side to render a Vike page, typically in a custom server setup (e.g., Express).

Sets up a basic Vike application with React, demonstrating the Vite configuration, a simple page component, and optional server-side data fetching.

import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import vike from 'vike/plugin'; // vite.config.ts export default defineConfig({ plugins: [react(), vike({ prerender: true })] }); // src/pages/index/+Page.tsx import React from 'react'; export default function Page() { return ( <> <h1>Hello Vike!</h1> <p>This is a Vike application with React.</p> </> ); } // src/pages/index/+data.ts (optional, for server-side data fetching) export type Data = { message: string }; export async function data(): Promise<Data> { return { message: 'Data fetched on server' }; }
vike --version
Debug
Known issues
breakingThe package name was changed from `vite-plugin-ssr` to `vike`. Existing applications must update their `package.json` and all import paths.
fix
Migrate `vite-plugin-ssr` to `vike` in `package.json` dependencies and update `import { something } from 'vite-plugin-ssr'` to `import { something } from 'vike'` or `import vike from 'vike/plugin'`.
affects: <0.1.0
gotchaVike requires Node.js version `>=20.19.0`. Running with older Node.js versions will result in startup errors.
fix
Ensure your development and deployment environments are running Node.js version 20.19.0 or higher. Use a Node.js version manager like `nvm` to switch versions if necessary.
affects: >=0.1.0
gotchaVike relies heavily on Vite's module resolution. Ensure your Vite configuration is correct, especially regarding aliases and server-side externalization, to avoid build or runtime issues.
fix
Consult the Vike and Vite documentation for best practices in configuring `vite.config.ts`. Pay close attention to `ssr.external` and `resolve.alias` settings.
affects: >=0.1.0
breakingThe `pageContext` object has evolved significantly over versions, with properties like `pageContext.pageExports` becoming available on the client-side only in later versions. Relying on undocumented or older `pageContext` structures can lead to breakage.
fix
Always refer to the official Vike documentation (`vike.dev`) for the current structure and available properties of `pageContext` for your specific Vike version. Use TypeScript types from `vike/types` for compile-time validation.
affects: <0.1.2
gotchaWhen prerendering (`prerender: true` in `vike()` plugin options), Vike expects all data fetching to be synchronous or properly awaited during the build process. Asynchronous operations that are not handled can lead to incomplete prerendered output.
fix
Ensure all server-side data fetching in `+data.js` or `+data.ts` files return promises that resolve before the page is rendered. Leverage `async/await` appropriately.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'vike/plugin'
Incorrect import path for the Vike Vite plugin, or an outdated package name.
fix
Ensure `vike` is installed and the import statement is `import vike from 'vike/plugin'` in `vite.config.ts`.
ReferenceError: require is not defined in ES module scope
Attempting to use CommonJS `require()` syntax in an ESM-only context (e.g., in a Vite configuration file or a Vike page file).
fix
Convert `require()` statements to `import` statements. Ensure your `package.json` specifies `"type": "module"` or files use `.mjs` or `.ts` extensions for ESM.
Vite plugin 'vike' requires Node.js version >=20.19.0
The installed Node.js version does not meet Vike's minimum requirements.
fix
Upgrade your Node.js installation to version 20.19.0 or newer. Consider using a tool like `nvm` for managing Node.js versions.
Error: Peer dependency 'vite' (>=6.3.0) not met for 'vike'
The installed version of Vite is older than what Vike requires.
fix
Update Vite to version 6.3.0 or higher. Run `npm install vite@latest` or `yarn add vite@latest`.
Upgrade
Version history
0.4.258latest on npm
Audit
Dependencies
react-streamingoptionalRequired for applications utilizing React's streaming capabilities, enabling faster perceived load times.
viterequiredCore build tool and development server, Vike is a Vite plugin.
Agent activity
4 hits · last 30 days
node
4
Resources
vike — npm install vike · libregistry