调试打包

This commit is contained in:
gyq
2024-03-05 14:35:19 +08:00
parent 4983ae1664
commit 0d04bfc3d2
6 changed files with 46 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
"use strict";
const electron = require("electron");
const path = require("path");
const path$1 = require("path");
function printUtils(params) {
return new Promise(async (resolvePrint, rejectPrint) => {
let subMainWindow = new electron.BrowserWindow({
@@ -13,7 +13,7 @@ function printUtils(params) {
enableRemoteModule: true
}
});
subMainWindow.loadFile(path.join(__dirname, "../public/print.html"));
subMainWindow.loadFile(path$1.join(__dirname, "../public/print.html"));
subMainWindow.webContents.on("did-finish-load", async (res) => {
subMainWindow.webContents.openDevTools();
console.log("网页加载完成", res);
@@ -28,9 +28,10 @@ function printUtils(params) {
});
});
}
const NODE_ENV = process.env.NODE_ENV;
electron.app.whenReady().then(() => {
const win = new electron.BrowserWindow({
title: "Main window",
title: "银收客",
width: 1200,
height: 800,
fullscreenable: true,
@@ -46,7 +47,10 @@ electron.app.whenReady().then(() => {
if (process.env.VITE_DEV_SERVER_URL) {
win.loadURL(process.env.VITE_DEV_SERVER_URL);
} else {
win.loadFile("dist/index.html");
win.loadFile(path.join(__dirname, "../dist/index.html"));
}
if (NODE_ENV == "development") {
win.webContents.openDevTools();
}
electron.app.on("activate", () => {
if (electron.BrowserWindow.getAllWindows().length === 0) {