function compileTemplate (templatePath, outputFilename, mainCompilation) {
  const childCompiler = getChildCompiler(mainCompilation.compiler);
  return childCompiler.compileTemplates(mainCompilation).then((compiledTemplates) => {
    if (!compiledTemplates[templatePath]) console.log(Object.keys(compiledTemplates), templatePath);
    const compiledTemplate = compiledTemplates[templatePath];
    // Replace [hash] placeholders in filename
    const outputName = mainCompilation.mainTemplate.hooks.assetPath.call(outputFilename, {
      hash: compiledTemplate.hash,
      chunk: compiledTemplate.entry
    });
    return {
      // Hash of the template entry point
      hash: compiledTemplate.hash,
      // Output name
      outputName: outputName,
      // Compiled code
      content: compiledTemplate.content
    };
  });
}
function compileTemplate (templatePath, outputFilename, mainCompilation) {
  const childCompiler = getChildCompiler(mainCompilation.compiler);
  return childCompiler.compileTemplates(mainCompilation).then((compiledTemplates) => {
    if (!compiledTemplates[templatePath]) console.log(Object.keys(compiledTemplates), templatePath);
    const compiledTemplate = compiledTemplates[templatePath];
    // Replace [hash] placeholders in filename
    const outputName = mainCompilation.mainTemplate.hooks.assetPath.call(outputFilename, {
      hash: compiledTemplate.hash,
      chunk: compiledTemplate.entry
    });
    return {
      // Hash of the template entry point
      hash: compiledTemplate.hash,
      // Output name
      outputName: outputName,
      // Compiled code
      content: compiledTemplate.content
    };
  });
}
function compileTemplate ( templatePath , outputFilename , mainCompilation ) { const childCompiler = getChildCompiler ( mainCompilation . compiler ) ; return childCompiler . compileTemplates ( mainCompilation ) . then ( ( compiledTemplates ) => { if ( ! compiledTemplates [ templatePath ] ) console . log ( Object . keys ( compiledTemplates ) , templatePath ) ; const compiledTemplate = compiledTemplates [ templatePath ] ; // Replace [hash] placeholders in filename const outputName = mainCompilation . mainTemplate . hooks . assetPath . call ( outputFilename , { hash : compiledTemplate . hash , chunk : compiledTemplate . entry } ) ; return { // Hash of the template entry point hash : compiledTemplate . hash , // Output name outputName : outputName , // Compiled code content : compiledTemplate . content } ; } ) ; }
Starts the compilation for all templates.
This has to be called once all templates where added.

If this function is called multiple times it will use a cache inside
the childCompiler

@param {string} templatePath
@param {string} outputFilename
@param {WebpackCompilation} mainCompilation
Starts the compilation for all templates . This has to be called once all templates where added .
Compile a template