-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add React support #61
Comments
Well.. basically just use react :) So.. I have a fork with a react branch. Have a look at it and also at its commit history: https://github.com/loopmode/electron-webpack-quick-start/tree/react It should give you a good starting point. I'll try to find some time and review the existing documentation (not much indeed) and check whether it..reflects the reality of using react with electron-webpack (and it's quick-start) |
@loopmode Were you able to execute imports from a bigger structure? like having another react components? It fails when it can't find a component I would like to use. |
@tbogard sure, I built a rather large application with react and electron-webpack, using three.js and rendering heavy and interactive 3D models and scenes. Also we used some native modules to control lamps in the room based on user interaction (for this we used IPC to communicate intent from renderer to main process, then triggered commands using DMX protocol) . Unfortunately I cannot share the code.. During the ca. 8 weeks of developing the app, electron-webpack never stood in our way and the performance was excellent, both in development (HMR) and in production. However, coming from web development with enough experience in both webpack and react, was essential. Still, not having any experience with electron, I was delighted to see that i didn't have to learn much new stuff (thanks to electron-webpack taking care of the electron-specific quirks like coordinating two webpack instances for main and renderer process) " It fails when it can't find a component I would like to use." |
I got react working by just running However, I don't know how to enable If I want to keep everything as is, but just add support for |
@loopmode I tried using your fork as a template but I just get I've copied your |
You have a couple of options, two of them are very easy but maybe feel inconvenient, the third one needs an inconvenient one-time solution but allows you to work the way you probably expect.
And finally, normally the best way: fork electron-webpack, make it do 3) by default an dsubmut a pull request. Releases have slowed down, but such improvement would surely land with the next release! |
It might seem silly that I write such a long reply instead of submitting a PR myself, but please note that I'm mostly participating here from my phone :) |
@loopmode and i'll write a short reply since I'm just to get on a train, but: thanks a lot! might submit a PR then, :) |
I guess the good old |
hi, just wanted to adress this: any suggestions? |
@mustafaKamal-fe there's at least two ways to get that done. One is where you'd do the module.hot.accept method, in your
Basically: on hot update, require new app module and render it to the DOM again. The other one, which you should try first, you can see in action here: https://github.com/loopmode/electron-webpack-quick-start/blob/react/src/renderer/App.js Let's call that method "hot export". |
This from https://webpack.electron.build/add-ons#react-jsx seems insufficient to a newbie like me. What should we do after this?
The text was updated successfully, but these errors were encountered: