13
13
/** @typedef {import("webpack").sources.Source } Source */
14
14
/** @typedef {{hash: string, entry: Chunk, content: string, assets: {[name: string]: { source: Source, info: import("webpack").AssetInfo }}} } ChildCompilationTemplateResult */
15
15
16
- let instanceId = 0 ;
17
16
/**
18
17
* The HtmlWebpackChildCompiler is a helper to allow reusing one childCompiler
19
18
* for multiple HtmlWebpackPlugin instances to improve the compilation performance.
@@ -24,8 +23,6 @@ class HtmlWebpackChildCompiler {
24
23
* @param {string[] } templates
25
24
*/
26
25
constructor ( templates ) {
27
- /** Id for this ChildCompiler */
28
- this . id = instanceId ++ ;
29
26
/**
30
27
* @type {string[] } templateIds
31
28
* The template array will allow us to keep track which input generated which output
@@ -110,12 +107,12 @@ class HtmlWebpackChildCompiler {
110
107
childCompiler . context = mainCompilation . compiler . context ;
111
108
112
109
// Generate output file names
113
- const temporaryTemplateNames = this . templates . map ( ( template , index ) => `__child-HtmlWebpackPlugin_${ index } -${ this . id } ` ) ;
110
+ const temporaryTemplateNames = this . templates . map ( ( template , index ) => `__child-HtmlWebpackPlugin_${ index } -${ template } ` ) ;
114
111
115
112
// Add all templates
116
113
this . templates . forEach ( ( template , index ) => {
117
- new EntryPlugin ( childCompiler . context , 'data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;' , `HtmlWebpackPlugin_${ index } -${ this . id } ` ) . apply ( childCompiler ) ;
118
- new EntryPlugin ( childCompiler . context , template , `HtmlWebpackPlugin_${ index } -${ this . id } ` ) . apply ( childCompiler ) ;
114
+ new EntryPlugin ( childCompiler . context , 'data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;' , `HtmlWebpackPlugin_${ index } -${ template } ` ) . apply ( childCompiler ) ;
115
+ new EntryPlugin ( childCompiler . context , template , `HtmlWebpackPlugin_${ index } -${ template } ` ) . apply ( childCompiler ) ;
119
116
} ) ;
120
117
121
118
// The templates are compiled and executed by NodeJS - similar to server side rendering
0 commit comments