electron-vue在打包过程中遇到报错:SyntaxError、ReferenceError的解决方法

2023-06-01 00:00:00 electron

electron-vue打包报错1:

ReferenceError: Multispinner is not defined

解决方式:

    //安装 multispinner
    yarn add multispinner -D

然后在build.js中引入multispinner

    const Multispinner = require('multispinner')


electron-vue打包报错2:

SyntaxError: Identifier 'tasks' has already been declared


解决方式:

将build.js tasks重命名

    //const tasks = ['main', 'renderer']
    const tasks1 = ['main', 'renderer']
    //const m = new Multispinner(tasks, {
      const m = new Multispinner(tasks1, {
        preText: 'building',
        postText: 'process'
      })


注意:

国内或者无条件翻墙可以换一下源


查看当前源:

yarn config get registry

更换源:

yarn config set registry https://registry.npm.taobao.org

相关文章