Skip to content

Commit d24d58d

Browse files
author
Sola-Ray
committed
[FIX] Window.js now in CJS
1 parent 75f4502 commit d24d58d

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/client/Window.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
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');
1010
const preloadPath = path.join(__dirname, '../preload.cjs');
1111
const htmlPath = path.join(__dirname, '../public/index.html');
1212
const configPath = path.join(__dirname, '../../windowConfig.json');
@@ -192,4 +192,6 @@ class Window {
192192
}
193193

194194
const 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; }

0 commit comments

Comments
 (0)