Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"chokidar": "^3.5.3",
"electron": "^21.0.0",
"electron-builder": "^23.6.0",
"electron-devtools-installer": "^3.2.0",
"typescript": "^4.8.4",
"vite": "^3.1.6"
},
Expand Down
16 changes: 13 additions & 3 deletions src/main/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {app, BrowserWindow, ipcMain, session} from 'electron';
import installExtension, { VUEJS3_DEVTOOLS } from 'electron-devtools-installer';
import {join} from 'path';

function createWindow () {
async function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
Expand All @@ -14,14 +15,23 @@ function createWindow () {

if (process.env.NODE_ENV === 'development') {
const rendererPort = process.argv[2];
mainWindow.loadURL(`http://localhost:${rendererPort}`);
await mainWindow.loadURL(`http://localhost:${rendererPort}`);
mainWindow.webContents.openDevTools();
}
else {
mainWindow.loadFile(join(app.getAppPath(), 'renderer', 'index.html'));
}
}

app.whenReady().then(() => {
app.whenReady().then(async () => {
if (process.env.NODE_ENV === 'development') {
try {
await installExtension(VUEJS3_DEVTOOLS)
} catch (e) {
console.error('Failed to install Vue Devtools:', (e as Error).toString())
}
}

createWindow();

session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
Expand Down