You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
51 lines
1.1 KiB
const { app, BrowserWindow } = require("electron");
|
|
const path = require("path");
|
|
|
|
let mainWindow;
|
|
|
|
app.on("ready", () => {
|
|
mainWindow = new BrowserWindow({
|
|
width: 800,
|
|
height: 600,
|
|
webPreferences: {
|
|
//preload: path.join(__dirname, "preload.js"),
|
|
contextIsolation: true, // Security setting
|
|
},
|
|
});
|
|
|
|
const indexPath = path.join(
|
|
__dirname,
|
|
"../../",
|
|
"dist-electron",
|
|
"index.html",
|
|
);
|
|
|
|
console.log("Loading Vue app from:", indexPath);
|
|
mainWindow.webContents.openDevTools();
|
|
|
|
mainWindow.webContents.on(
|
|
"did-fail-load",
|
|
(event, errorCode, errorDescription, validatedURL) => {
|
|
console.error(
|
|
"Failed to load:",
|
|
validatedURL,
|
|
"Error:",
|
|
errorDescription,
|
|
);
|
|
},
|
|
);
|
|
|
|
mainWindow.webContents.on("console-message", (event, level, message) => {
|
|
console.log(`[Renderer] ${message}`);
|
|
});
|
|
|
|
mainWindow.loadFile(indexPath).catch((err) => {
|
|
console.error("Failed to load index.html:", err);
|
|
});
|
|
});
|
|
|
|
app.on("window-all-closed", () => {
|
|
if (process.platform !== "darwin") {
|
|
app.quit();
|
|
}
|
|
});
|
|
|