Vite plugin for generating robots.txt files with separate configurations for production and development builds. Current stable version is 1.0.5, released with a consistent cadence. Key differentiator: it allows you to define different robots.txt rules based on build mode by reading `.robots.[mode].txt` or `.robots.[mode].txt.local` files from the project root, making it easy to block crawlers in development and allow them in production without manual file swapping.
npm install vite-plugin-robotsVerified import paths — ran on the pinned version, not inferred.
Shows how to install, import, and configure the plugin with example robots.txt files for production and development.
Place your robots.txt files in the project root with the correct naming convention.
Remove `skip` property from config; instead omit the plugin or set `false` conditionally.
Change `import robots from 'vite-plugin-robots'` to `import { robots } from 'vite-plugin-robots'`.Ensure you have only one set of `.robots.*.txt` files or combine rules manually.
Use `import { robots } from 'vite-plugin-robots'` instead of `const { robots } = require('vite-plugin-robots')`.Change to `import { robots } from 'vite-plugin-robots'`.Use `robots({...})` in the plugins array, not just `robots`.