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.
npm install sitemap-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Configures SitemapPlugin with a base URL, an array of paths (strings or objects with path/lastmod/priority), and global options like filename and lastmod.
Use sitemap-webpack-plugin@0.5.1 for webpack 3 or lower.
Use new SitemapPlugin({ base, paths, options: { filename: 'custom.xml' } })Set skipgzip: true if you do not want a .xml.gz file.
Use lastmod: '2023-01-01' for a fixed date, or lastmod: true for current date.
const SitemapPlugin = require('sitemap-webpack-plugin').default;Install sitemap-webpack-plugin@0.5.1: npm install sitemap-webpack-plugin@0.5.1 --save-dev
npm install sitemap