@@ -469,57 +469,55 @@ class LynxTemplatePluginImpl {
469469
470470 this . hash = createHash ( compiler . options . output . hashFunction ?? 'xxhash64' ) ;
471471
472- compiler . hooks . initialize . tap ( this . name , ( ) => {
473- // entryName to fileName conversion function
474- const userOptionFilename = this . #options. filename ;
475-
476- const filenameFunction = typeof userOptionFilename === 'function'
477- ? userOptionFilename
478- // Replace '[name]' with entry name
479- : ( entryName : string ) =>
480- userOptionFilename . replace ( / \[ n a m e \] / g, entryName ) ;
481-
482- /** output filenames for the given entry names */
483- const entryNames = Object . keys ( compiler . options . entry ) ;
484- const outputFileNames = new Set (
485- ( entryNames . length > 0 ? entryNames : [ 'main' ] ) . map ( ( name ) =>
486- filenameFunction ( name )
487- ) ,
488- ) ;
472+ // entryName to fileName conversion function
473+ const userOptionFilename = this . #options. filename ;
474+
475+ const filenameFunction = typeof userOptionFilename === 'function'
476+ ? userOptionFilename
477+ // Replace '[name]' with entry name
478+ : ( entryName : string ) =>
479+ userOptionFilename . replace ( / \[ n a m e \] / g, entryName ) ;
480+
481+ /** output filenames for the given entry names */
482+ const entryNames = Object . keys ( compiler . options . entry ) ;
483+ const outputFileNames = new Set (
484+ ( entryNames . length > 0 ? entryNames : [ 'main' ] ) . map ( ( name ) =>
485+ filenameFunction ( name )
486+ ) ,
487+ ) ;
489488
490- outputFileNames . forEach ( ( outputFileName ) => {
491- // convert absolute filename into relative so that webpack can
492- // generate it at correct location
493- let filename = outputFileName ;
494- if ( path . resolve ( filename ) === path . normalize ( filename ) ) {
495- filename = path . relative (
496- /** Once initialized the path is always a string */
497- compiler . options . output . path ! ,
498- filename ,
499- ) ;
500- }
489+ outputFileNames . forEach ( ( outputFileName ) => {
490+ // convert absolute filename into relative so that webpack can
491+ // generate it at correct location
492+ let filename = outputFileName ;
493+ if ( path . resolve ( filename ) === path . normalize ( filename ) ) {
494+ filename = path . relative (
495+ /** Once initialized the path is always a string */
496+ compiler . options . output . path ! ,
497+ filename ,
498+ ) ;
499+ }
501500
502- compiler . hooks . thisCompilation . tap ( this . name , ( compilation ) => {
503- compilation . hooks . processAssets . tapPromise (
504- {
505- name : this . name ,
506- stage :
507- /**
508- * Generate the html after minification and dev tooling is done
509- * and source-map is generated
510- */
511- compiler . webpack . Compilation
512- . PROCESS_ASSETS_STAGE_OPTIMIZE_HASH ,
513- } ,
514- ( ) => {
515- return this . #generateTemplate(
516- compiler ,
517- compilation ,
518- filename ,
519- ) ;
520- } ,
521- ) ;
522- } ) ;
501+ compiler . hooks . thisCompilation . tap ( this . name , ( compilation ) => {
502+ compilation . hooks . processAssets . tapPromise (
503+ {
504+ name : this . name ,
505+ stage :
506+ /**
507+ * Generate the html after minification and dev tooling is done
508+ * and source-map is generated
509+ */
510+ compiler . webpack . Compilation
511+ . PROCESS_ASSETS_STAGE_OPTIMIZE_HASH ,
512+ } ,
513+ ( ) => {
514+ return this . #generateTemplate(
515+ compiler ,
516+ compilation ,
517+ filename ,
518+ ) ;
519+ } ,
520+ ) ;
523521 } ) ;
524522 } ) ;
525523
0 commit comments