解决打包问题
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
const electron = require("electron");
|
||||
const path$1 = require("path");
|
||||
const path = 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$1.join(__dirname, "../public/print.html"));
|
||||
subMainWindow.loadFile(path.join(__dirname, "../public/print.html"));
|
||||
subMainWindow.webContents.on("did-finish-load", async (res) => {
|
||||
subMainWindow.webContents.openDevTools();
|
||||
console.log("网页加载完成", res);
|
||||
@@ -28,16 +28,15 @@ function printUtils(params) {
|
||||
});
|
||||
});
|
||||
}
|
||||
const NODE_ENV = process.env.NODE_ENV;
|
||||
electron.app.whenReady().then(() => {
|
||||
const win = new electron.BrowserWindow({
|
||||
title: "银收客",
|
||||
width: 1200,
|
||||
height: 800,
|
||||
fullscreenable: true,
|
||||
fullscreen: true,
|
||||
fullscreen: false,
|
||||
simpleFullscreen: true,
|
||||
frame: false,
|
||||
frame: true,
|
||||
webPreferences: {
|
||||
// 集成网页和 Node.js,也就是在渲染进程中,可以调用 Node.js 方法
|
||||
nodeIntegration: true,
|
||||
@@ -47,11 +46,9 @@ electron.app.whenReady().then(() => {
|
||||
if (process.env.VITE_DEV_SERVER_URL) {
|
||||
win.loadURL(process.env.VITE_DEV_SERVER_URL);
|
||||
} else {
|
||||
win.loadFile(path.join(__dirname, "../dist/index.html"));
|
||||
}
|
||||
if (NODE_ENV == "development") {
|
||||
win.webContents.openDevTools();
|
||||
win.loadFile(path.resolve(__dirname, "../dist/index.html"));
|
||||
}
|
||||
win.webContents.openDevTools();
|
||||
electron.app.on("activate", () => {
|
||||
if (electron.BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
|
||||
Reference in New Issue
Block a user