使用electron-vue出现Webpack ReferenceError: process is not defined

2020-03-05 23:56:59

参考地址 使用electron-vue出现Webpack ReferenceError: process is not defined

问题描述
在使用electron-vue时候,运行npn run dev,会出现下面的错误



解决
没有搜索到合适的答案,在GitHub的electron-vue的issue中找到了

方案一
简单粗暴,不知道会不会有什么影响,直接将这段代码去掉


方案二
根据别人在issue里面的写法,.electron-vue/webpack.web.config.js 和.electron-vue/webpack.renderer.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
    }),

  • 2021-06-08 11:20:55

    安装iohook出错

    no such file or directory, open 'C:\Users\me\AppData\Local\Temp\prebuild.tar.gz'

  • 2021-08-13 23:10:31

    ios framework中的图片如何访问

    特别简单,在主工程设置中,只要resource parse加入那个图片文件夹或者图片目录就可以正常访问了

  • 2021-08-13 23:15:04

    最新iOS APP打包上传到AppStore教程

    作为一名iOS开发者,把辛辛苦苦开发出来的App上传到App Store是件必要的事。但是很多人还是不知道该怎么上传到App Store上,下面就来详细讲解一下具体流程步骤。