I'm currently working on setting up a sitemap for my live environment and I've encountered an issue while trying to utilize the sitemap-webpack-plugin. The error message I received is as follows:
ERROR in TypeError: compilation.emitAsset is not a function
at /Users/ME/Sites/test-site/node_modules/sitemap-webpack-plugin/lib/index.js:378:41
at Array.forEach (<anonymous>)
at SitemapWebpackPlugin.<anonymous> (/Users/ME/Sites/test-site/node_modules/sitemap-webpack-plugin/lib/index.js:377:34)
at step (/Users/ME/Sites/test-site/node_modules/sitemap-webpack-plugin/lib/index.js:86:23)
at Object.next (/Users/ME/Sites/test-site/node_modules/sitemap-webpack-plugin/lib/index.js:67:53)
at fulfilled (/Users/ME/Sites/test-site/node_modules/sitemap-webpack-plugin/lib/index.js:57:58)
This is what my package.json looks like:
"sitemap-webpack-plugin": "^1.1.0",
"webpack": "4.28.0",
Here's a snippet of code from my webpack.prod file:
const SitemapPlugin = require('sitemap-webpack-plugin').default;
const paths = ['url/', 'url/url2'];
// further down the file within plugins:
new SitemapPlugin({ base: 'https://www.bob.com', paths })
Since I'm using webpack 4, I assumed that emitAsset should be functional. Has anyone else faced this particular issue?