@@ -240,25 +240,25 @@ async function generateBundle(this: PluginContext, bundle: OutputBundle, config:
240240 }
241241
242242 const getPublicIcon = ( faviconName : string ) => {
243- if ( ! Object . prototype . hasOwnProperty . call ( globalPublicFilesCache , faviconName ) ) {
244- // dist/favicon.ico
245- let _path = path . join ( config . build . outDir , faviconName )
246- if ( fs . existsSync ( _path ) ) {
247- globalRemoveDistFileNames . add ( faviconName )
248- } else {
249- // public/favicon.ico
250- _path = path . join ( config . publicDir , faviconName )
251- if ( ! fs . existsSync ( _path ) ) return null
252- }
253- // read
254- const b = fs . readFileSync ( _path )
255- globalPublicFilesCache [ faviconName ] = {
256- buffer : b ,
257- dataURL : bufferToDataURL ( faviconName , b ) ,
258- size : b . length
259- }
243+ if ( Object . prototype . hasOwnProperty . call ( globalPublicFilesCache , faviconName ) ) {
244+ return globalPublicFilesCache [ faviconName ]
245+ }
246+ // dist/favicon.ico
247+ let _path = path . join ( config . build . outDir , faviconName )
248+ if ( fs . existsSync ( _path ) ) {
249+ globalRemoveDistFileNames . add ( faviconName )
250+ } else {
251+ // public/favicon.ico
252+ _path = path . join ( config . publicDir , faviconName )
253+ if ( ! fs . existsSync ( _path ) ) return null
254+ }
255+ // read
256+ const b = fs . readFileSync ( _path )
257+ return globalPublicFilesCache [ faviconName ] = {
258+ buffer : b ,
259+ dataURL : bufferToDataURL ( faviconName , b ) ,
260+ size : b . length
260261 }
261- return globalPublicFilesCache [ faviconName ]
262262 }
263263
264264 const linkFaviconAll = document . querySelectorAll < HTMLLinkElement > ( `link[rel=icon][href]:not([href=""]),link[rel="shortcut icon"][href]:not([href=""])` )
0 commit comments