leave this alone // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION, preload: path.join(__dirname, '/preload.js') }, }); ...
解决方案 在vue.config.js中如下配置 module.exports= {pluginOptions:{electronBuilder:{preload:'src/preload.js'} } } 截取background.js的部分代码 win =newBrowserWindow({webPreferences: {nodeIntegration:true,contextIsolation:false,webviewTag:true,preload: path.join(__dirname,'/preload.js') },resizabl...
在使用vue-cli-plugin-electron-builder打包后发现应用程序没有执行preload.js文件于是查找原因 根据查阅的资料打包后的源文件放在\dist_electron\win-unpacked\resources\app.asar,app.asar是一个压缩文件需要解压才能看到里面的内容 npm install -g asar /** cd到app.asar所在的目录,将文件解压到file文件夹 **/ a...
主进程是main.js这毫无疑问,前端页面和主进程的通信需要通过预加载脚本preload.js,预加载脚本就是一个桥梁。 二、安装electron 安装electron-icon-builder图标生成工具,终端运行 npm i electron-icon-builder,最好使用该工具生成图标,它会生成不同尺寸的图标以及ico和苹果的icns图标,这个工具生成的图标不会出现异常情况...
Vue CLI Plugin Electron Builder Easily Build Your Vue.js App For Desktop With Electron Build status: Quick Start: Open a terminal in the directory of your app created with Vue-CLI 3 or 4 (4 is recommended). Then, install and invoke the generator of vue-cli-plugin-electron-builder by run...
在使用vue-cli-plugin-electron-builder创建的 Electron 项目中,你可以通过修改主进程代码和渲染进程中的 Vue 组件来实现点击按钮打开新窗口的功能。即使没有单独的preload.js文件,你仍然可以通过 IPC(进程间通信)在主进程和渲染进程之间进行通信。 以下是实现这一功能的步骤: ...
Electron Builder是一个流行的工具,用于打包和分发Electron应用。你可以通过npm安装它: bash npm install electron-builder --save-dev 6. 修改package.json 在package.json文件中,添加一些Electron相关的脚本: json "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "elec...
module.exports = { pluginOptions: { electronBuilder: { preload: 'src/preload.js', } }} electron远程模块remote优化 remote模块在 Electron 12 中被弃用,并将在 Electron 14 中移除。它被@electron/remote模块取代 。1.安装扩展。cnpm install --save @electron/remote 2.安装完成 先在...
"electron:serve": "vue-cli-service electron:serve", "electron:build": "vue-cli-service electron:build", "electron:build:win32": "vue-cli-service electron:build --win --ia32" vue.config.js添加打包配置 在module.exports中添加以下配置:(可自定义) pluginOptions: { electronBuilder: { // pr...
Vue CLI Plugin Electron Builder: 该方案是集成到到vue-cli中使用,使用vue add electron-builder后可直接上手,免去了基础配置的步骤。但是其只能在vue-cli下使用,无法配合vite来使用。 因此,若要使用vite和electron,还需要自己来配置。 源码:github.com/Kuari/Blog/t 系列文章: Vite+Electron快速构建一个VUE3桌面...