electron+vue项目使用serialport报错Cannot read property ‘indexOf‘ of undefined解决办法

描述

使用Electron+Vue项目时引入serialport串口后启动时报下面错误

Cannot read property 'indexOf' of undefined

electron+vue项目使用serialport报错Cannot read property ‘indexOf‘ of undefined解决办法_第1张图片

解决方法

打开vue.config.js找到pluginOptions -> electronBuilder -> externals添加serialport

module.exports = {
  pluginOptions: {
    electronBuilder: {
      externals: ['serialport'],
    }
  }
}

你可能感兴趣的:(【,踩过的坑,】,vue.js,javascript,serialport)