I'm trying to build a sitemap in my production environment and I have been trying to use sitemap-webpack-plugin but get the following error:
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)
My package.json:
"sitemap-webpack-plugin": "^1.1.0",
"webpack": "4.28.0",
Inside my webpack.prod:
const SitemapPlugin = require('sitemap-webpack-plugin').default;
const paths = ['url/', 'url/url2'];
// later down the file inside plugins:
new SitemapPlugin({ base: 'https://www.bob.com', paths })
As I'm using webpack 4 I thought emitAsset should work?
Has anyone else come across this?