官方网站:Build cross-platform desktop apps with JavaScript, HTML, and CSS ~| Electron (electronjs.org)
使用方法
1、使用Vite创建Electron项目。
yarn create vite
2、解压app.asar文件。
yarn global add asar
asar .\app.asar .\build\
常见问题
1、执行yarn run build报错:Search string not found: "for (const existingRoot of buildInfoVersionMap.roots) { (Use `node ~-~-trace-uncaught ...` to show where the exception was thrown)。
执行以下代码升级vue-tsc即可。
yarn remove vue-tsc
yarn add vue-tsc -D
2、执行yarn run build报错:errorOut=ERROR: Cannot create symbolic link。
用PowerShell以管理员身份在项目根目录执行 yarn run build 编译成功,然后用VSCode执行 yarn run build 就不会报错了。生成的安装包在release文件夹中。
3、Error: DXC create compiler failed with
未知。
4、Electron编译后打开exe报错:Uncaught (in promise) RuntimeError: abort(RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info.). Build with -s ASSERTIONS=1 for more info.
未知。