Closed helpforsoftware closed 2 months ago
main.js file
const { app, BrowserWindow,ipcRenderer } = require('electron')
const isDev=true
//const isDev = require('electron-is-dev')
var path=require('path')
require('@electron/remote/main').initialize()
//import {getGitResult} from './gitExtensions'
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
contextIsolation:true,
nodeIntegration: true,
preload: path.join(__dirname, 'preload.js')
}
})
//const {ipcRenderer} = win.require('electron')
win.loadURL('http://localhost:3000');
}
app.whenReady().then(() => {
createWindow()
//const win = new BrowserWindow()
//win.webContents.openDevTools()
})
app.on('window-all-closed', () => {
if `(process.platform` !== 'darwin') app.quit()
})
ğğğ
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
i made contextisolation false. nothing changed
i found sthe solution .in newer version on electron they prevented to run unsecure code for security reasons. so we need to use ipcRenderer to get apis from main to react app renderer.
import { GitProcess, GitError, IGitResult } from 'dugite'
in app.js
i am using react with electron
ERROR in ./node_modules/dugite/build/lib/git-process.js 34:11-24 Module not found: Error: Can't resolve 'fs' in 'C:\Users\intruder\Documents\GitHub\Git History Crawler\node_modules\dugite\build\lib' ERROR in ./node_modules/dugite/build/lib/git-process.js 36:24-48 Module not found: Error: Can't resolve 'child_process' in 'C:\Users\intruder\Documents\GitHub\Git History Crawler\node_modules\dugite\build\lib'
can you help me ?