Fixed Linux build

This commit is contained in:
Geomitron
2024-07-10 17:15:58 -05:00
parent 55f5b871f3
commit ba357d5fea
2 changed files with 6 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import electron from 'electron'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const electron = require('electron')
import { ContextBridgeApi, IpcFromMainEmitEvents, IpcInvokeEvents, IpcToMainEmitEvents } from '../src-shared/interfaces/ipc.interface.js'
function getInvoker<K extends keyof IpcInvokeEvents>(key: K) {

View File

@@ -3,6 +3,9 @@ import fs from 'fs'
const filePath = './dist/electron/src-electron/preload.js'
const newFilePath = './dist/electron/src-electron/preload.mjs'
/** This is the dumbest hack I've ever implemented, but it works lol */
if (fs.existsSync(filePath)) {
fs.renameSync(filePath, newFilePath)
const mjsFile = fs.readFileSync(filePath).toString('utf8')
fs.writeFileSync(newFilePath, mjsFile.replace(/export {};/, ''))
fs.rmSync(filePath)
}