Loading

electron制作上位机软件篇(三)启动项目并进行打包

一、项目启动

npm run dev

启动前提:

1、已二次编译serialport

2、在webpack中添加:{serialport: 'serialport'}

  externals: [
  	......
    {
      serialport: 'serialport'
    }
  ],

正常启动:

二、项目打包

我在打包过程中多次卡在serialport下载编译依赖,所以我对node_modules中serialport的下载命令进行修改

1、进入node_modules/@serialport/bindings/package.json

将install对应的重编译命令修改为:

node-gyp rebuild --target=2.0.4 --arch=x64 --dist-url=https://npm.taobao.org/mirrors/atom-shell

根据自己需要编译为32或64位:

32位:ia32
64位:x64

2、进行打包:

npm run build
或者
npm run build:dir(非安装)
posted @ 2020-05-07 11:27  小飞猪咯咯  阅读(1342)  评论(0编辑  收藏  举报