Vite plugin for automatic Vue Router route generation based on file system structure. Version 1.0.16, actively maintained. Scans a specified directory for Vue components and metadata files to produce a routes file with lazy-loading imports. Supports nested routes, auto-redirects, and optional per-route metadata. Requires Vite >=3.0.0 and Node >=14. Differentiated by tight Vue Router integration and zero-config file-based routing.
npm install vite-plugin-generate-routeVerified import paths — ran on the pinned version, not inferred.
Configures the plugin and uses generated routes in Vue Router setup.
Use import statement. Change commonjs to ES module in vite.config.
Do not edit the output routes file directly. Adjust pageDir or configuration instead.
Use unique file names or customize page.js to set explicit name via metadata.
Upgrade to Vite >=3.0.0.
Change to 'import VitePluginGenerateRoute from 'vite-plugin-generate-route'' and ensure package.json has 'type': 'module'.
Ensure the routesFile option is set to an absolute or correct relative path (e.g., 'src/routes/generateRoutes.js' and imported from a file at 'src/router/index.js' as './routes/generateRoutes').