File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { BrowserWindow , screen } from 'electron' ;
2- import { fileURLToPath } from 'url' ;
3- import path from 'path' ;
4- import fs from 'fs' ;
1+ const { BrowserWindow, screen } = require ( 'electron' ) ;
2+ /* ESM fileURLToPath removed in CJS */
3+ const path = require ( 'path' ) ;
4+ const fs = require ( 'fs' ) ;
55
6- const __filename = fileURLToPath ( import . meta. url ) ;
7- const __dirname = path . dirname ( __filename ) ;
86
9- const iconPath = path . join ( __dirname , '../resources/app.ico' ) ;
7+ const iconPath = fs . existsSync ( path . join ( __dirname , '../resources/app.ico' ) )
8+ ? path . join ( __dirname , '../resources/app.ico' )
9+ : path . join ( process . cwd ( ) , 'resources' , 'app.ico' ) ;
1010const preloadPath = path . join ( __dirname , '../preload.cjs' ) ;
1111const htmlPath = path . join ( __dirname , '../public/index.html' ) ;
1212const configPath = path . join ( __dirname , '../../windowConfig.json' ) ;
@@ -192,4 +192,6 @@ class Window {
192192}
193193
194194const window = new Window ( ) ;
195- export default window ;
195+ module . exports = window ;
196+
197+ if ( module && module . exports && module . exports !== exports ) { module . exports . default = module . exports ; }
You can’t perform that action at this time.
0 commit comments