3ni8ma/vite-plugin
LibraryLive in productionVite sitemap plugin that auto-generates SEO sitemaps on build
Vite plugin for auto-generating sitemap.xml and robots.txt on build
www.npmjs.com/package/@3ni8ma/vite-plugin-sitemap
- TypeScript100.0%
1 Review
This plugin keeps sitemap generation simple and fits naturally into Vite’s closeBundle lifecycle. It supports plain route strings and route-specific metadata, normalizes trailing slashes on the hostname, escapes URLs before inserting them into XML, creates missing output directories, and generates both compact and readable output. The package uses strict TypeScript, exports its option types, declares Vite as a peer dependency, and ships only compiled files. Dependabot and GitHub Actions provide basic dependency maintenance and compilation checks.
The biggest issue is that the README describes a different API from the implementation. Documentation lists robotsTxt, but that option does not exist and robots.txt is always generated. It says the defaults are monthly and 0.7, while the code uses weekly and 0.5. It describes lastmod as a Date, but the type accepts only a string. The documented default for outDir is Vite’s configured build directory, while the plugin independently defaults to dist, which can place files in the wrong folder when build.outDir is customized. Options such as change frequency, priority, date format, hostname, and disallowed paths also lack runtime validation or complete XML escaping.
There are no tests, test script, releases, or full LICENSE file. Tests should run real Vite builds with custom roots and output directories, inspect the resulting XML, verify escaping, and cover the robots behavior. The plugin should also use config.build.outDir, support an explicit robots toggle, validate sitemap values, and remove unused options and imports. Finally, the large collection of automated timestamp comments adds noise to the README and dominates the repository history without improving the package.
