electron-vue 中出现 process is not defined
刚创建好的electron项目提示process is not defined 如下图
解决方案参考: https://github.com/SimulatedGREG/electron-vue/issues/871
解决方案:
1、找到 .electron-vue/webpack.web.config.js 和.electron-vue/webpack.renderer.config.js 文件
2、找到 new HtmlWebpackPlugin() 这个方法,在里面新增红色区域代码
新增代码:
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