错误如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Html Webpack Plugin:
ReferenceError: process is not defined

- index.ejs:11 eval
[.]/[html-webpack-plugin]/lib/loader.js!./src/index.ejs:11:2

- index.ejs:16 module.exports
[.]/[html-webpack-plugin]/lib/loader.js!./src/index.ejs:16:3

- index.js:284
[test]/[html-webpack-plugin]/index.js:284:18

- task_queues.js:97 processTicksAndRejections
internal/process/task_queues.js:97:5

image-20200813112345890

正确解决

找到./src/index.ejs

image-20200813112654901

<% if (!process.browser) { %> 更改为

1
<%  if (!require('process').browser) { %>

image-20200813113110631

再次运行 npm run dev 即可成功启动

image-20200813113154446

参考:https://github.com/SimulatedGREG/electron-vue/issues/871