{"id":20522,"library":"robotstxt-webpack-plugin","title":"robotstxt-webpack-plugin","description":"A webpack plugin to generate a robots.txt file for your project. Version 8.0.0 is current, released August 2022. It requires webpack 5+ and Node.js >=14.15.0. Built on top of generate-robotstxt, it supports all options from that package. Simplified setup compared to manual creation, integrates with webpack's asset pipeline. Last update was 2022; no recent activity, but still functional for webpack 5 projects.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/itgalaxy/robotstxt-webpack-plugin","tags":["javascript","robots.txt","robots","robotstxt","generate","robots-txt","user-agent","webpack","webpack-plugin"],"install":[{"cmd":"npm install robotstxt-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add robotstxt-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add robotstxt-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for plugin to function","package":"webpack","optional":false},{"reason":"Underlying package that generates the robots.txt content","package":"generate-robotstxt","optional":true}],"imports":[{"note":"Plugin is exported as CommonJS default. For ESM, use the require or use default export workaround.","wrong":"import RobotstxtPlugin from 'robotstxt-webpack-plugin';","symbol":"RobotstxtPlugin","correct":"const RobotstxtPlugin = require('robotstxt-webpack-plugin');"},{"note":"Available as default export for ESM users.","symbol":"RobotstxtPlugin","correct":"import RobotstxtPlugin from 'robotstxt-webpack-plugin';"},{"note":"In CJS, the default export is the plugin itself, not under .default. But due to ESM interop, some setups may need this pattern.","wrong":"const RobotstxtPlugin = require('robotstxt-webpack-plugin').default;","symbol":"default","correct":"const { default: RobotstxtPlugin } = require('robotstxt-webpack-plugin');"}],"quickstart":{"code":"const RobotstxtPlugin = require('robotstxt-webpack-plugin');\n\nmodule.exports = {\n  plugins: [\n    new RobotstxtPlugin({\n      // Generates a robots.txt that disallows all\n      userAgent: '*',\n      disallow: '/',\n    }),\n  ],\n};","lang":"javascript","description":"Configures webpack to output a robots.txt disallowing all crawlers."},"warnings":[{"fix":"Upgrade webpack to version 5 or later.","message":"Minimum supported webpack version is 5","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Upgrade Node.js to version 14.15.0 or later.","message":"Minimum supported Node.js version is 14.15.0","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Use the new class name RobotstxtPlugin instead of RobotstxtWebpackPlugin.","message":"In version 5.0.0, the plugin was renamed from RobotstxtWebpackPlugin to RobotstxtPlugin","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Replace RobotstxtWebpackPlugin with RobotstxtPlugin.","message":"Old class name RobotstxtWebpackPlugin is no longer available","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Use const RobotstxtPlugin = require('robotstxt-webpack-plugin'); (default export directly).","message":"CommonJS require does not work as expected in some bundler setups","severity":"gotcha","affected_versions":">=5.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev robotstxt-webpack-plugin","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'robotstxt-webpack-plugin'"},{"fix":"Use new class name RobotstxtPlugin.","cause":"Using old class name RobotstxtWebpackPlugin which was renamed in v5.","error":"TypeError: RobotstxtWebpackPlugin is not a constructor"},{"fix":"Ensure generate-robotstxt is installed: npm install generate-robotstxt","cause":"Missing underlying dependency when using certain options.","error":"Module not found: Error: Can't resolve 'generate-robotstxt'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}