electron-vue报错:Webpack ReferenceError: process is not defined

electron-vue报错:Webpack ReferenceError: process is not defined

博客说明

文章所涉及的资料来自互联网整理和个人总结,意在于个人学习和经验汇总,如有什么地方侵权,请联系本人删除,谢谢!

问题截图

image-20200612204627022

问题说明

在搭建electron的项目的时候出现了这样的问题,原因大概就是node.js的版本问题,在nodejs的11版本没有出现这样的问题,一般是nodejs的12版本出现此问题

问题解决

.electron-vue/webpack.web.config.js.electron-vue/webpack.renderer.config.js下的HtmlWebpackPlugin添加一段代码

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

image-20200612205024484

测试

再次运行项目,发现已经成功了

image-20200612205112815

感谢

Electron-vue

以及勤劳的自己

猜你喜欢

转载自blog.csdn.net/qq_45163122/article/details/106723458