amilajack / erb-serialport-example

An example of using electron-react-boilerplate with serialport
MIT License
14 stars 6 forks source link

Unable to work this example with the latest version of electron-react-boilerplate (v0.17.1) #16

Closed baymac closed 5 years ago

baymac commented 5 years ago

In the react boiler plate, I added the package.json from this repo into the /app dir. Also added the script to internals ExternalRebuild.js as in this repository but when I run yarn I get following error:

import path from 'path';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at loader (/home/parichay/electron-nrf/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/parichay/electron-nrf/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Kindly help me fix this. Or if possible let me know how can I integrate serialport into the v0.17.1 version of electron-react-boilerplate. Thanks.

baymac commented 5 years ago

I was able to fix this. Add the app/package.json to webpack base config and used the following script in app/package.json:

"scripts": {
    "electron-rebuild": "../node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir .",
    "postinstall": "yarn electron-rebuild"
  }