mainWindow.once('ready-to-show', ()=>{ setTimeout(()=>{ console.log('完成') mainWindow.removeBrowserView(view) },500); }) ipcMain.on('stop-loading-main', ()=>{ mainWindow.removeBrowserView(view) })//and load the index.html of the app.if(MAIN_WINDOW_VITE_DEV_SERVER_URL) { ...
console.log(process.env.npm_lifecycle_event);//if (process.env.npm_lifecycle_event === "start") {//win.loadURL("http://127.0.0.1:3212");//win.webContents.openDevTools();///快捷命令shift+ctrl+i//} else {//win.loadFile("dist/index.html");//}if(process.env.VITE_DEV_SERVER_URL)...
electron-->main.ts functioncreateWindow(){//部分代码if(VITE_DEV_SERVER_URL){//加载链接(我们可以直接将h5的项目链接放到这里)win.loadURL(VITE_DEV_SERVER_URL)}else{//加载文件// win.loadFile('dist/index.html')win.loadFile(path.join(process.env.DIST,"index.html"))}//捕获a标签的打开事件,使...
Run two versions of the electron-vite app... the first runs fine... the second will fail as main.js tries to load on the wrong port. Additional information No response GitMurfchanged the title@electron-forge/plugin-vite (pre-release) - MAIN_WINDOW_VITE_DEV_SERVER_URL not updating when ...
// win.loadURL('http://localhost:3000') // development模式 if(process.env.VITE_DEV_SERVER_URL) { win.loadURL(process.env.VITE_DEV_SERVER_URL) // 开启调试台 win.webContents.openDevTools() }else { win.loadFile(join(__dirname, '../dist/index.html')) ...
electron vite typescript 启动时打开了两个窗口 首先简单的理解一下Electron的进程类型——渲染进程和主进程 主进程: Electron 运行 package.json 的 main 脚本的进程。 渲染进程: 在 web 页面运行的进程。 一个Electron 应用有且只有一个主进程。 主进程中运行的脚本通过创建web页面来展示用户界面。 每个 Electron...
"dev": "electron-vite dev", // start dev server and electron app "prebuild": "electron-vite build" // build for production } } 为了使用热更新(HMR),需要使用环境变量(ELECTRON_RENDERER_URL)来决定 Electron 窗口加载本地页面还是远程页面。
这些步骤将涵盖安装和配置 Electron、创建 Vite 项目并集成 Electron、配置 Electron Builder、编写 Electron 主进程和渲染进程代码,以及构建和测试 Electron 应用。 1. 安装并配置 Electron 和 Vite 首先,你需要确保你的系统中已经安装了 Node.js。然后,你可以使用 npm 或 yarn 来安装 Vite 和 Electron。 bash npm...
"dev": "vite", "build": "vite build", "electron:serve": "vite build & electron . ", "electron:build": "electron-builder", "preview": "vite preview" }, 1. 2. 3. 4. 5. 6. 7. 输入命令进行打包: npm run electron:build