Registry / devops / sitemap-webpack-plugin

sitemap-webpack-plugin

JSON →
library1.1.1jsnpmunverified

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-plugin
INSTALL
IMPORT
SIG · SITEMAP-WEBPACK-PL
S
sitemap-webpack-plugin
devopsjavascriptv1.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SitemapPlugin
import SitemapPlugin from 'sitemap-webpack-plugin'
const SitemapPlugin = require('sitemap-webpack-plugin')
The package is ESM-first with TypeScript types. In CommonJS, require the default export.

Configures SitemapPlugin with a base URL, an array of paths (strings or objects with path/lastmod/priority), and global options like filename and lastmod.

// webpack.config.js const SitemapPlugin = require('sitemap-webpack-plugin'); module.exports = { plugins: [ new SitemapPlugin({ base: 'https://example.com', paths: [ '/page1', '/page2', { path: '/page3', lastmod: '2023-01-01', priority: 0.8 }, ], options: { filename: 'sitemap.xml', skipgzip: false, lastmod: true, priority: 0.5, changefreq: 'monthly', }, }), ], };
Debug
Known issues
breakingVersion 1.x requires webpack 4 or 5. For webpack <=3, use version 0.5.x.
fix
Use sitemap-webpack-plugin@0.5.1 for webpack 3 or lower.
affects: >=1.0.0
gotchaThe constructor expects options as the third argument, not as part of the first object. Many users mistakenly pass options inside the first argument.
fix
Use new SitemapPlugin({ base, paths, options: { filename: 'custom.xml' } })
affects: *
deprecatedThe 'skipgzip' option defaults to false. In older versions, gzip was always generated; now you can skip it explicitly.
fix
Set skipgzip: true if you do not want a .xml.gz file.
affects: >=1.0.0
gotchaThe 'lastmod' option set to boolean 'true' uses the current date. Provide a string for static dates.
fix
Use lastmod: '2023-01-01' for a fixed date, or lastmod: true for current date.
affects: *
Errors
Common errors & fixes
TypeError: SitemapPlugin is not a constructor
Using incorrect import style (named import instead of default) in CommonJS.
fix
const SitemapPlugin = require('sitemap-webpack-plugin').default;
Error: Webpack version 3 not supported. Use version 0.5.x of sitemap-webpack-plugin.
Using version 1.x with webpack 3.
fix
Install sitemap-webpack-plugin@0.5.1: npm install sitemap-webpack-plugin@0.5.1 --save-dev
Module not found: Can't resolve 'sitemap'
Missing peer dependency 'sitemap'.
fix
npm install sitemap
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
sitemaprequiredUsed under the hood to generate the sitemap XML.
Agent activity
14 hits · last 30 days
node
14
Resources
sitemap-webpack-plugin — npm install sitemap-webpack-plugin · libregistry