kumarryogeshh / electron-react-parcel-boilerplate

Boilerplate code to create basic, production ready Electron app using React, Parcel application bundler.
MIT License
50 stars 9 forks source link

Using `--target node` and `--target electron` #4

Open nyxynyx opened 4 years ago

nyxynyx commented 4 years ago

Hello there, your boilerplate is working great until I encountered the errors fs.existsSync is not a function and Cannot statically evaluate fs argument after trying to use another npm package. While trying to troubleshoot it, I tried to specify the Parcel targets node and electron by changing the line in package.json from

"react-start": "parcel -p 3000 index.html --out-dir build",

to

"react-start": "parcel -p 3000 index.html --out-dir build --target node",

and

"react-start": "parcel -p 3000 index.html --out-dir build --target electron",

However, running yarn start no longer launch the Electron app and no server is listening to http://localhost:3000.

What is the correct way to set the targets to node and electron?

Thank you very much!


GitHub Repo to reproduce problem: https://github.com/nyxynyx/electron-react-parcel-boilerplate-problem