解决打包问题

This commit is contained in:
gyq
2024-03-06 10:49:45 +08:00
parent 48d6583a03
commit 91ce993270
11 changed files with 119 additions and 118 deletions

View File

@@ -1,17 +1,16 @@
import { app, BrowserWindow, ipcMain } from "electron";
import path from 'path'
import { printUtils } from './printUtils'
const NODE_ENV = process.env.NODE_ENV
app.whenReady().then(() => {
const win = new 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,
@@ -21,14 +20,12 @@ app.whenReady().then(() => {
// You can use `process.env.VITE_DEV_SERVER_URL` when the vite command is called `serve`
if (process.env.VITE_DEV_SERVER_URL) {
win.loadURL(process.env.VITE_DEV_SERVER_URL); // 使用vite开发服务的url路径访问应用
win.loadURL(process.env.VITE_DEV_SERVER_URL);
// 使用vite开发服务的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();
app.on("activate", () => {
// 在 macOS 系统内, 如果没有已开启的应用窗口