webpack.config.js
function getHtmlTemplates(dirName) {
  const html_conf = [];
  // create the array of HTML plugins.
  const template = path.join(dirName, '_template.html');
  getExamples(dirName, (entryName, filename) => {
    html_conf.push(
      new HtmlWebpackPlugin({
        title: entryName,
        // ensure each output has a unique filename
        filename: entryName + '.html',
        template,
        // without specifying chunks, all chunks are
        //  included with the file.
        chunks: ['common', entryName]
      })
    );
  });
  return html_conf;
}
function getHtmlTemplates(dirName) {
  const html_conf = [];
  // create the array of HTML plugins.
  const template = path.join(dirName, '_template.html');
  getExamples(dirName, (entryName, filename) => {
    html_conf.push(
      new HtmlWebpackPlugin({
        title: entryName,
        // ensure each output has a unique filename
        filename: entryName + '.html',
        template,
        // without specifying chunks, all chunks are
        //  included with the file.
        chunks: ['common', entryName]
      })
    );
  });
  return html_conf;
}
function getHtmlTemplates ( dirName ) { const html_conf = [ ] ; // create the array of HTML plugins. const template = path . join ( dirName , '_template.html' ) ; getExamples ( dirName , ( entryName , filename ) => { html_conf . push ( new HtmlWebpackPlugin ( { title : entryName , // ensure each output has a unique filename filename : entryName + '.html' , template , // without specifying chunks, all chunks are //  included with the file. chunks : [ 'common' , entryName ] } ) ) ; } ) ; return html_conf ; }
Each example needs a dedicated HTML file.
This will create a "plugin" that outputs HTML from a template.

@param {String} dirName - Name of the directory to read.

@returns {Array} specifying webpack plugins.
Each example needs a dedicated HTML file . This will create a plugin that outputs HTML from a template .