vite-plugin-pages-router (v1.0.25) is a Vite plugin that provides Next.js-style file-based routing for React projects. It scans .tsx files in a pages directory and auto-generates React Router v6 route configs via Vite's virtual module system. Unlike similar plugins (e.g., vite-plugin-pages), this plugin avoids generating a file on disk, keeping the route configuration internal. Requires React 18+, React Router v6+, and Vite 4+. Ships TypeScript types. Development appears active with recent releases.
npm install vite-plugin-pages-routerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Minimal setup: register plugin in vite.config.ts, then use RouterConfig component in App to enable file-based routing.
Use the correct import path: import createFileRouterPlugin from 'vite-plugin-pages-router/plugin'
Use default import: import RouterConfig from 'vite-plugin-pages-router'
Simply import RouterConfig from the package name; Vite will resolve it virtually.
Ensure both options point to existing .tsx files that export default a component.
Run npm install vite-plugin-pages-router and verify the import path is 'vite-plugin-pages-router/plugin'.
Change to: import RouterConfig from 'vite-plugin-pages-router'
Use default import from 'vite-plugin-pages-router/plugin': import createFileRouterPlugin from 'vite-plugin-pages-router/plugin'
Ensure the file exists at the specified path relative to project root.