Если еще актуально, то можно сделать так:
const fs = require('fs')
{...}
const PATHS = {
src: path.join(__dirname, '../src'),
dist: path.join(__dirname, '../dist'),
assets: 'assets/'
}
{...}
const PAGES_DIR = `${PATHS.src}/${PATHS.assets}pages/`
const PAGES = fs.readdirSync(PAGES_DIR).filter(fileName => fileName.endsWith('.pug'))
{...}
module.exports = {
{...}
plugins: [
{...}
...PAGES.map(page => new HtmlWebpackPlugin ({
template: `${PAGES_DIR}/${page}`,
filename: `./${page.replace(/\.pug/,'.html')}`
}))
],
}