创建electron-vue项目,运行后出现这个错误:ReferenceError: process is not defined
解决办法:
修改.electron-vue文件夹里面的webpack.renderer.config.js和webpack.web.config.js这两个文件
两个文件要修改的内容都是一样的,都是找到"new HtmlWebpackPlugin"这个位置,在里面添加下面这段代码:
templateParameters(compilation, assets, options) {
return {
compilation: compilation,
webpack: compilation.getStats().toJson(),
webpackConfig: compilation.options,
htmlWebpackPlugin: {
files: assets,
options: options
},
process,
};
},
return {
compilation: compilation,
webpack: compilation.getStats().toJson(),
webpackConfig: compilation.options,
htmlWebpackPlugin: {
files: assets,
options: options
},
process,
};
},