lib/compiler.js
function extractHelperFilesFromCompilation (mainCompilation, childCompilation, filename, childEntryChunks) {
  const helperAssetNames = childEntryChunks.map((entryChunk, index) => {
    return mainCompilation.mainTemplate.hooks.assetPath.call(filename, {
      hash: childCompilation.hash,
      chunk: entryChunk,
      name: `HtmlWebpackPlugin_${index}`
    });
  });

  helperAssetNames.forEach((helperFileName) => {
    delete mainCompilation.assets[helperFileName];
  });

  const helperContents = helperAssetNames.map((helperFileName) => {
    return childCompilation.assets[helperFileName].source();
  });

  return helperContents;
}
function extractHelperFilesFromCompilation (mainCompilation, childCompilation, filename, childEntryChunks) {
  const helperAssetNames = childEntryChunks.map((entryChunk, index) => {
    return mainCompilation.mainTemplate.hooks.assetPath.call(filename, {
      hash: childCompilation.hash,
      chunk: entryChunk,
      name: `HtmlWebpackPlugin_${index}`
    });
  });

  helperAssetNames.forEach((helperFileName) => {
    delete mainCompilation.assets[helperFileName];
  });

  const helperContents = helperAssetNames.map((helperFileName) => {
    return childCompilation.assets[helperFileName].source();
  });

  return helperContents;
}
function extractHelperFilesFromCompilation ( mainCompilation , childCompilation , filename , childEntryChunks ) { const helperAssetNames = childEntryChunks . map ( ( entryChunk , index ) => { return mainCompilation . mainTemplate . hooks . assetPath . call ( filename , { hash : childCompilation . hash , chunk : entryChunk , name : ` ${ index } ` } ) ; } ) ; helperAssetNames . forEach ( ( helperFileName ) => { delete mainCompilation . assets [ helperFileName ] ; } ) ; const helperContents = helperAssetNames . map ( ( helperFileName ) => { return childCompilation . assets [ helperFileName ] . source ( ) ; } ) ; return helperContents ; }
The webpack child compilation will create files as a side effect.
This function will extract them and clean them up so they won't be written to disk.

Returns the source code of the compiled templates as string

@returns Array<string>
The webpack child compilation will create files as a side effect . This function will extract them and clean them up so they won t be written to disk .