@@ -750,15 +750,17 @@ class CodeInjector implements ICodeInjector {
750750
751751 async computeSourcesHash ( folderPath : string = this . spaTmpPath ( ) , allFiles : string [ ] = [ ] ) {
752752 const files = await fs . promises . readdir ( folderPath , { withFileTypes : true } ) ;
753- allFiles . push ( ...files . map ( ( file ) => path . join ( folderPath , file . name ) ) ) ;
754753 const hashes = await Promise . all (
755754 files . map ( async ( file ) => {
756755 const filePath = path . join ( folderPath , file . name ) ;
757756
758- // 🚫 Skip node_modules
759- if ( file . name === 'node_modules' || file . name === 'dist' ) {
757+ // 🚫 Skip big files or files which might be dynamic
758+ if ( file . name === 'node_modules' || file . name === 'dist' ||
759+ file . name === 'i18n-messages.json' || file . name === 'i18n-empty.json' ) {
760760 return '' ;
761761 }
762+
763+ allFiles . push ( filePath ) ;
762764
763765 if ( file . isDirectory ( ) ) {
764766 return this . computeSourcesHash ( filePath , allFiles ) ;
@@ -795,7 +797,8 @@ class CodeInjector implements ICodeInjector {
795797
796798 const allFiles = [ ] ;
797799 const sourcesHash = await this . computeSourcesHash ( this . spaTmpPath ( ) , allFiles ) ;
798- process . env . VERY_HEAVY_DEBUG && console . log ( '🪲🪲 allFiles:' , JSON . stringify ( allFiles . sort ( ( a , b ) => a . localeCompare ( b ) ) , null , 1 ) )
800+ process . env . VERY_HEAVY_DEBUG && console . log ( '🪲🪲 allFiles:' , JSON . stringify (
801+ allFiles . sort ( ( a , b ) => a . localeCompare ( b ) ) , null , 1 ) )
799802
800803 const buildHash = await this . tryReadFile ( path . join ( serveDir , '.adminforth_build_hash' ) ) ;
801804 const messagesHash = await this . tryReadFile ( path . join ( serveDir , '.adminforth_messages_hash' ) ) ;
@@ -828,10 +831,6 @@ class CodeInjector implements ICodeInjector {
828831 // copy i18n messages to serve dir
829832 await fsExtra . copy ( path . join ( cwd , 'i18n-messages.json' ) , path . join ( serveDir , 'i18n-messages.json' ) ) ;
830833
831- // rm i18n-messages.json and i18n-empty.json from spa tmp, or they will affect hash
832- await fs . promises . rm ( path . join ( cwd , 'i18n-messages.json' ) , { force : true } ) ;
833- await fs . promises . rm ( path . join ( cwd , 'i18n-empty.json' ) , { force : true } ) ;
834-
835834 // save hash
836835 await fs . promises . writeFile ( path . join ( serveDir , '.adminforth_messages_hash' ) , sourcesHash ) ;
837836 } else {
0 commit comments