{"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,"search_vec":"'14.15.0':29 '2022':22,59 '5':26,68 '8.0.0':17 'activ':62 'agent':80 'asset':54 'august':21 'built':30 'compar':46 'creation':49 'current':19 'file':12 'function':65 'generat':9,35,74 'generate-robotstxt':34 'integr':50 'javascript':70 'last':56 'manual':48 'node.js':28 'option':40 'packag':43 'pipelin':55 'plugin':4,7,84 'project':15,69 'recent':61 'releas':20 'requir':24 'robot':72,76 'robots-txt':75 'robots.txt':11,71 'robotstxt':2,36,73 'robotstxt-webpack-plugin':1 'setup':45 'simplifi':44 'still':64 'support':38 'top':32 'txt':77 'updat':57 'user':79 'user-ag':78 'version':16 'webpack':3,6,25,52,67,81,83 'webpack-plugin':82","created_at":"2026-04-25T11:23:34.776213+00:00","updated_at":"2026-04-25T11:23:34.776213+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/itgalaxy/robotstxt-webpack-plugin","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/robotstxt-webpack-plugin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}