electron-vue 中出现 process is not defined

发布于 4 年前 作者 phonegap100 1655 次浏览 最后一次编辑是 4 年前 来自 分享

刚创建好的electron项目提示process is not defined 如下图

1.png

解决方案参考: https://github.com/SimulatedGREG/electron-vue/issues/871

解决方案:

1、找到 .electron-vue/webpack.web.config.js 和.electron-vue/webpack.renderer.config.js 文件

2.png

2、找到 new HtmlWebpackPlugin() 这个方法,在里面新增红色区域代码

3.png

4.png

新增代码:

templateParameters(compilation, assets, options) {
        return {
          compilation: compilation,
          webpack: compilation.getStats().toJson(),
          webpackConfig: compilation.options,
          htmlWebpackPlugin: {
            files: assets,
            options: options
          },
          process,
        };
      }

解决方案参考https://github.com/SimulatedGREG/electron-vue/issues/871

回到顶部