Registry / devops / vite-plugin-pages-sitemap

vite-plugin-pages-sitemap

JSON →
library1.7.1jsnpmunverified

Sitemap generator plugin for Vite that integrates with vite-plugin-pages to automatically generate sitemaps from file-based routing. Version 1.7.1 is the current stable release. The plugin is actively maintained. Key differentiators: it leverages the routes generated by vite-plugin-pages, supports dynamic routes, i18n with alternate links, custom hostname, exclusion patterns, and configuration for changefreq, priority, lastmod, and readable XML output. It also integrates with Nuxt.js style route naming and can generate a robots.txt. Alternative to generic sitemap generators when using vite-plugin-pages.

npm install vite-plugin-pages-sitemap
INSTALL
IMPORT
SIG · VITE-PLUGIN-PAGES-
V
vite-plugin-pages-sitemap
devopsjavascriptv1.7.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

generateSitemap
✓ import generateSitemap from 'vite-plugin-pages-sitemap'
✗ const generateSitemap = require('vite-plugin-pages-sitemap')
Default export. The package is ESM-only since v1.0, so use import syntax.

Basic setup integrating vite-plugin-pages and generating a sitemap on routes generation.

import Pages from 'vite-plugin-pages'; import generateSitemap from 'vite-plugin-pages-sitemap'; export default { plugins: [ Pages({ onRoutesGenerated: (routes) => { generateSitemap({ routes, hostname: 'https://example.com' }); }, }), ], };
Debug
Known issues
breakingPrior to v1.0, the plugin used a different configuration API. Upgrade required.
fix
Update to >=1.0.0 and adjust config to use new API: pass options to generateSitemap directly.
affects: <1.0.0
deprecatedPassing routes as a separate option is deprecated; use the onRoutesGenerated callback instead.
fix
Use onRoutesGenerated hook as shown in quickstart.
affects: >=1.0.0 <1.5.0
gotchaThe plugin requires vite-plugin-pages as a peer dependency; must be installed separately.
fix
Ensure vite-plugin-pages is installed: npm install -D vite-plugin-pages
affects: >=1.0.0
gotchaDynamic routes must be passed as part of the routes array in generateSitemap options; not automatically detected.
fix
Manually add dynamic routes to the routes array as shown in README.
affects: >=1.0.0
gotchaThe hostname option defaults to 'http://localhost/'; forgetting to set it for production will result in incorrect sitemap URLs.
fix
Pass hostname option with production URL.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'vite-plugin-pages-sitemap'
Package not installed or module resolution issue.
fix
Run npm install -D vite-plugin-pages-sitemap
TypeError: generateSitemap is not a function
Import incorrectly as named import instead of default.
fix
Use import generateSitemap from 'vite-plugin-pages-sitemap';
Error: Cannot read property 'route' of undefined
Routes not provided or undefined.
fix
Ensure you pass routes option with an array of route objects or strings.
Upgrade
Version history
1.7.1latest on npm
Audit
Dependencies
vite-plugin-pagesrequiredpeer dependency; routes must be generated by vite-plugin-pages
Agent activity
6 hits · last 30 days
node
6
Resources
vite-plugin-pages-sitemap — npm install vite-plugin-pages-sitemap · libregistry