问题描述:前段时间,因实际需求更新了本地的Node.js版本,后来发现项目运行起来报错,报错信息如下:
说明:之前项目是用nodev10.1.5搭的,后来更新之后,node变更为12.0。
解决方法:修改 .electron-vue/webpack.renderer.config.js 和 webpack.web.config.js如下:
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
templateParameters(compilation, assets, options) {
return {
compilation: compilation,
webpack: compilation.getStats().toJson(),
webpackConfig: compilation.options,
htmlWebpackPlugin: {
files: assets,
options: options
},
process,
};
},
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true
},
nodeModules: false
}),
下边是修改之前的文件: