electron vue 开发环境运行白屏, build之后运行exe正常
环境: node 10.16.0; npm 6.9.0; vue 2.9.6;
使用的是simulatedgreg/electron-vue模板
npm install -g vue-cli
vue init simulatedgreg/electron-vue my-project
cd my-project
npm install
npm run dev
查询过官方文档, 给出的答案如下(说实话不明白是什么意思):
相关运行npm run dev后终端结果如下
D:autoar-project>npm run dev
> [email protected] dev D:autoar-project
> node .electron-vue/dev-runner.js
___ __
__ /\_ __ ___ / \__ _ __ ___ ___ __ __ __ __ __
/ ,.` // / ,.` /'___ ,_ /` __ / __` /' _ ` _______ / / / / / ,.`
/ __/ \_ \_ / __/ / \__/ / / / \_ / / /\______\ / | \_ / __/
\____ /\____\ \____\ \____ \_ \_ \____/ \_ \_\/______/ \___/ \____/ \____
/____/ /____/ /____/ /____/ \__ /_/ /___/ /_//_/ /__/ /___/ /____/
/__/
getting ready...
┏ Main Process ---------------
compiling...
┗ ----------------------------
┏ Renderer Process -----------
Hash: 1fc850d234a4f1f8fa80
Version: webpack 4.44.0
Time: 4280ms
Built at: 2020-07-28 2:48:54 PM
Asset Size Chunks Chunk Names
imgs/logo--assets.png 60.4 KiB [emitted]
index.html 404 bytes [emitted]
renderer.js 1.8 MiB renderer [emitted] renderer
Entrypoint renderer = renderer.js
[1] multi (webpack)-dev-server/client?http://localhost ./.electron-vue/dev-client ./src/renderer/main.js 52 bytes {renderer} [built]
[./.electron-vue/dev-client.js] 731 bytes {renderer} [built]
[./node_modules/strip-ansi/index.js] 161 bytes {renderer} [built]
[./node_modules/vue/dist/vue.esm.js] 319 KiB {renderer} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost] (webpack)-dev-server/client?http://localhost 4.29 KiB {renderer} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {renderer} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {renderer} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {renderer} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {renderer} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {renderer} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {renderer} [built]
[./node_modules/webpack-hot-middleware/client.js?noInfo=true&reload=true] (webpack)-hot-middleware/client.js?noInfo=true&reload=true 7.68 KiB {renderer} [built]
[./node_modules/webpack/hot sync ^./log$] (webpack)/hot sync nonrecursive ^./log$ 170 bytes {renderer} [built]
[./src/renderer/App.vue] 1.1 KiB {renderer} [built]
[./src/renderer/main.js] 382 bytes {renderer} [built]
+ 61 hidden modules
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 1.37 MiB 0
Entrypoint undefined = index.html
[./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs] 1.15 KiB {0} [built]
[./node_modules/lodash/lodash.js] 530 KiB {0} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {0} [built]
┗ ----------------------------
┏ Main Process ---------------
Hash: 88bb6d703c6351e1cebb
Version: webpack 4.44.0
Time: 4833ms
Built at: 2020-07-28 2:48:55 PM
Asset Size Chunks Chunk Names
main.js 218 KiB main [emitted] main
Entrypoint main = main.js
[0] multi ./src/main/index.dev.js ./src/main/index.js 40 bytes {main} [built]
[./node_modules/cross-unzip/index.js] 1.5 KiB {main} [built]
[./node_modules/electron-debug sync recursive] ./node_modules/electron-debug sync 160 bytes {main} [built]
[./node_modules/electron-debug/index.js] 2.46 KiB {main} [built]
[./node_modules/electron-devtools-installer/dist/downloadChromeExtension.js] 2.26 KiB {main} [built]
[./node_modules/electron-devtools-installer/dist/index.js] 5.02 KiB {main} [built]
[./node_modules/electron-devtools-installer/dist/utils.js] 1.88 KiB {main} [built]
[./node_modules/electron-is-dev/index.js] 256 bytes {main} [built]
[./node_modules/electron-localshortcut/index.js] 8.78 KiB {main} [built]
[./node_modules/semver/semver.js] 37.9 KiB {main} [built]
[./src/main/index.dev.js] 342 bytes {main} [built]
[./src/main/index.js] 801 bytes {main} [built]
[electron] external "electron" 42 bytes {main} [built]
[fs] external "fs" 42 bytes {main} [built]
[path] external "path" 42 bytes {main} [built]
+ 33 hidden modules
WARNING in ./node_modules/electron-debug/index.js 81:45-58
Critical dependency: the request of a dependency is an expression
@ ./src/main/index.dev.js
@ multi ./src/main/index.dev.js ./src/main/index.js
WARNING in ./node_modules/electron-debug/index.js 84:85-106
Critical dependency: the request of a dependency is an expression
@ ./src/main/index.dev.js
@ multi ./src/main/index.dev.js ./src/main/index.js
┗ ----------------------------
┏ Electron -------------------
Debugger listening on ws://127.0.0.1:5858/8
┗ ----------------------------
┏ Electron -------------------
2023a2f-67d4-4e8d-a501-75630b89c4b0
For help see https://nodejs.org/en/docs/inspector
┗ ----------------------------
期待看到
实际看到
求大神帮忙分析一下是什么原因, Google了一圈都没有遇到我这样的, 基本都是打包出现白屏
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…