@@ -127,7 +127,7 @@ class HtmlRspackPlugin {
127127 typeof userOptionFilename === 'function'
128128 ? userOptionFilename
129129 : // Replace '[name]' with entry name
130- ( entryName ) => userOptionFilename . replace ( / \[ n a m e \] / g, entryName ) ;
130+ ( entryName ) => userOptionFilename . replace ( / \[ n a m e \] / g, entryName ) ;
131131
132132 /** output filenames for the given entry names */
133133 const entryNames = Object . keys ( compiler . options . entry ) ;
@@ -224,7 +224,7 @@ class HtmlRspackPlugin {
224224
225225 // If the template doesn't use a loader use the lodash template loader
226226 if ( template . indexOf ( '!' ) === - 1 ) {
227- const loader = require . resolve ( './loader .js' ) ;
227+ const loader = require . resolve ( './htmlLoader .js' ) ;
228228 template = loader + '!' + path . resolve ( context , template ) ;
229229 }
230230
@@ -368,18 +368,18 @@ class HtmlRspackPlugin {
368368 ? customPublicPath
369369 : isPublicPathDefined
370370 ? // If a hard coded public path exists use it
371- webpackPublicPath
371+ webpackPublicPath
372372 : // If no public path was set get a relative url path
373- path
374- . relative (
375- path . resolve (
373+ path
374+ . relative (
375+ path . resolve (
376+ compilation . options . output . path ,
377+ path . dirname ( filename ) ,
378+ ) ,
376379 compilation . options . output . path ,
377- path . dirname ( filename ) ,
378- ) ,
379- compilation . options . output . path ,
380- )
381- . split ( path . sep )
382- . join ( '/' ) ;
380+ )
381+ . split ( path . sep )
382+ . join ( '/' ) ;
383383
384384 if ( publicPath . length && publicPath . substr ( - 1 , 1 ) !== '/' ) {
385385 publicPath += '/' ;
@@ -595,10 +595,10 @@ class HtmlRspackPlugin {
595595 return typeof newSource === 'string' || typeof newSource === 'function'
596596 ? Promise . resolve ( newSource )
597597 : Promise . reject (
598- new Error (
599- 'The loader "' + templateWithoutLoaders + '" didn\'t return html.' ,
600- ) ,
601- ) ;
598+ new Error (
599+ 'The loader "' + templateWithoutLoaders + '" didn\'t return html.' ,
600+ ) ,
601+ ) ;
602602 }
603603
604604 /**
@@ -652,19 +652,19 @@ class HtmlRspackPlugin {
652652 const templateParameterFunction =
653653 typeof templateParameters === 'function'
654654 ? // A custom function can overwrite the entire template parameter preparation
655- templateParameters
655+ templateParameters
656656 : // If the template parameters is an object merge it with the default values
657- ( compilation , assetsInformationByGroups , assetTags , options ) =>
658- Object . assign (
659- { } ,
660- templateParametersGenerator (
661- compilation ,
662- assetsInformationByGroups ,
663- assetTags ,
664- options ,
665- ) ,
666- templateParameters ,
667- ) ;
657+ ( compilation , assetsInformationByGroups , assetTags , options ) =>
658+ Object . assign (
659+ { } ,
660+ templateParametersGenerator (
661+ compilation ,
662+ assetsInformationByGroups ,
663+ assetTags ,
664+ options ,
665+ ) ,
666+ templateParameters ,
667+ ) ;
668668 const preparedAssetTags = {
669669 headTags : this . prepareAssetTagGroupForRendering ( assetTags . headTags ) ,
670670 bodyTags : this . prepareAssetTagGroupForRendering ( assetTags . bodyTags ) ,
@@ -747,7 +747,7 @@ class HtmlRspackPlugin {
747747 const htmlRegExp = / ( < h t m l [ ^ > ] * > ) / i;
748748 const headRegExp = / ( < \/ h e a d \s * > ) / i;
749749 const bodyRegExp = / ( < \/ b o d y \s * > ) / i;
750- const doctypeRegExp = / < ! d o c t y p e h t m l > / i
750+ const doctypeRegExp = / < ! d o c t y p e h t m l > / i;
751751
752752 const metaViewportRegExp = / < m e t a [ ^ > ] + n a m e = [ " ' ] v i e w p o r t [ " ' ] [ ^ > ] * > / i;
753753 const body = assetTags . bodyTags . map ( ( assetTagObject ) =>
@@ -785,7 +785,10 @@ class HtmlRspackPlugin {
785785 if ( ! headRegExp . test ( html ) ) {
786786 if ( ! htmlRegExp . test ( html ) ) {
787787 if ( doctypeRegExp . test ( html ) ) {
788- html = html . replace ( doctypeRegExp , ( match ) => match + '<head></head>' ) ;
788+ html = html . replace (
789+ doctypeRegExp ,
790+ ( match ) => match + '<head></head>' ,
791+ ) ;
789792 } else {
790793 html = '<head></head>' + html ;
791794 }
@@ -855,7 +858,7 @@ class HtmlRspackPlugin {
855858 return promisify ( compilation . inputFileSystem . readFile ) ( filename )
856859 . then ( ( buf ) => {
857860 const source = new compiler . webpack . sources . RawSource (
858- /** @type {string | Buffer } */ ( buf ) ,
861+ /** @type {string | Buffer } */ ( buf ) ,
859862 false ,
860863 ) ;
861864 const name = path . basename ( filename ) ;
@@ -869,7 +872,7 @@ class HtmlRspackPlugin {
869872 if ( this . options . hash ) {
870873 return this . appendHash (
871874 faviconPath ,
872- /** @type {string } */ ( compilation . hash ) ,
875+ /** @type {string } */ ( compilation . hash ) ,
873876 ) ;
874877 }
875878
@@ -948,8 +951,8 @@ class HtmlRspackPlugin {
948951 attributes :
949952 typeof base === 'string'
950953 ? {
951- href : base ,
952- }
954+ href : base ,
955+ }
953956 : base ,
954957 } ,
955958 ] ;
@@ -975,9 +978,9 @@ class HtmlRspackPlugin {
975978 const metaTagContent = metaOptions [ metaName ] ;
976979 return typeof metaTagContent === 'string'
977980 ? {
978- name : metaName ,
979- content : metaTagContent ,
980- }
981+ name : metaName ,
982+ content : metaTagContent ,
983+ }
981984 : metaTagContent ;
982985 } )
983986 . filter ( ( attribute ) => attribute !== false ) ;
@@ -1216,8 +1219,8 @@ class HtmlRspackPlugin {
12161219 // Inject scripts to body unless it set explicitly to head
12171220 const scriptTarget =
12181221 this . options . inject === 'head' ||
1219- ( this . options . inject !== 'body' &&
1220- this . options . scriptLoading !== 'blocking' )
1222+ ( this . options . inject !== 'body' &&
1223+ this . options . scriptLoading !== 'blocking' )
12211224 ? 'head'
12221225 : 'body' ;
12231226 // Group assets to `head` and `body` tag arrays
@@ -1282,11 +1285,11 @@ class HtmlRspackPlugin {
12821285 typeof compilationResult !== 'function'
12831286 ? compilationResult
12841287 : this . executeTemplate (
1285- compilationResult ,
1286- assetsHookResult . assets ,
1287- { headTags : assetTags . headTags , bodyTags : assetTags . bodyTags } ,
1288- compilation ,
1289- ) ,
1288+ compilationResult ,
1289+ assetsHookResult . assets ,
1290+ { headTags : assetTags . headTags , bodyTags : assetTags . bodyTags } ,
1291+ compilation ,
1292+ ) ,
12901293 ) ;
12911294
12921295 const injectedHtmlPromise = Promise . all ( [
0 commit comments