{"id":20553,"library":"sitemap-webpack-plugin","title":"Sitemap Webpack Plugin","description":"Webpack plugin to generate a sitemap.xml from a list of paths. Version 1.1.1 supports webpack 4 and 5 (for webpack <=3, use 0.5.x). It relies on the 'sitemap' library, supports gzipped output by default, and offers path-specific options like lastmod, priority, and changefreq. TypeScript types are included. Released under MIT license with weekly npm downloads around 6k.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/schneidmaster/sitemap-webpack-plugin","tags":["javascript","webpack","plugin","sitemap","static","typescript"],"install":[{"cmd":"npm install sitemap-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add sitemap-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add sitemap-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used under the hood to generate the sitemap XML.","package":"sitemap","optional":false}],"imports":[{"note":"The package is ESM-first with TypeScript types. In CommonJS, require the default export.","wrong":"const SitemapPlugin = require('sitemap-webpack-plugin')","symbol":"SitemapPlugin","correct":"import SitemapPlugin from 'sitemap-webpack-plugin'"}],"quickstart":{"code":"// webpack.config.js\nconst SitemapPlugin = require('sitemap-webpack-plugin');\n\nmodule.exports = {\n  plugins: [\n    new SitemapPlugin({\n      base: 'https://example.com',\n      paths: [\n        '/page1',\n        '/page2',\n        { path: '/page3', lastmod: '2023-01-01', priority: 0.8 },\n      ],\n      options: {\n        filename: 'sitemap.xml',\n        skipgzip: false,\n        lastmod: true,\n        priority: 0.5,\n        changefreq: 'monthly',\n      },\n    }),\n  ],\n};","lang":"javascript","description":"Configures SitemapPlugin with a base URL, an array of paths (strings or objects with path/lastmod/priority), and global options like filename and lastmod."},"warnings":[{"fix":"Use sitemap-webpack-plugin@0.5.1 for webpack 3 or lower.","message":"Version 1.x requires webpack 4 or 5. For webpack <=3, use version 0.5.x.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use new SitemapPlugin({ base, paths, options: { filename: 'custom.xml' } })","message":"The constructor expects options as the third argument, not as part of the first object. Many users mistakenly pass options inside the first argument.","severity":"gotcha","affected_versions":"*"},{"fix":"Set skipgzip: true if you do not want a .xml.gz file.","message":"The 'skipgzip' option defaults to false. In older versions, gzip was always generated; now you can skip it explicitly.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use lastmod: '2023-01-01' for a fixed date, or lastmod: true for current date.","message":"The 'lastmod' option set to boolean 'true' uses the current date. Provide a string for static dates.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"const SitemapPlugin = require('sitemap-webpack-plugin').default;","cause":"Using incorrect import style (named import instead of default) in CommonJS.","error":"TypeError: SitemapPlugin is not a constructor"},{"fix":"Install sitemap-webpack-plugin@0.5.1: npm install sitemap-webpack-plugin@0.5.1 --save-dev","cause":"Using version 1.x with webpack 3.","error":"Error: Webpack version 3 not supported. Use version 0.5.x of sitemap-webpack-plugin."},{"fix":"npm install sitemap","cause":"Missing peer dependency 'sitemap'.","error":"Module not found: Can't resolve 'sitemap'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}