Fork me on GitHub
#figwheel-main
<
2019-08-25
>
dominicm05:08:26

There's something in pedestal for this

Abhinav Sharma13:08:28

Hi Guys, has anyone experimented with setting up electronjs with figwheel-main - it'd be nice if you could share a link or some guidance here 🙂

mauricio.szabo23:08:30

I have an electron app with shadow-cljs, if you need any help :)

Abhinav Sharma05:08:09

Thank! Yeah, would be great is you could point me to it and I'll go through it

mauricio.szabo13:08:20

Ok, what I did was to create a JS project that would only load the Electron env, and activate node integration: https://github.com/mauricioszabo/repl-tooling/blob/master/integration.js Then I've configured a browser target: https://github.com/mauricioszabo/repl-tooling/blob/master/shadow-cljs.edn.

mauricio.szabo13:08:03

When I need to require things, I've used (js/require "my-dependency") for example. There's a configuration for shadow-cljs to resolve these things to you so you can use the namespace format too

mauricio.szabo13:08:24

For example, you can configure a :browser target and add the configuration :js-options {:js-provider :require} inside the browser target, so it'll emit require(...) commands on the JS side

Abhinav Sharma16:08:04

Hmm, this seems nice @U3Y18N0UC thanks for taking the time to look into it man 👍 ! Let me explore this direction more over the weekend.

👍 4
practicalli-johnny21:08:53

@abhi18av I am no expert, but it seems shadow-cljs may be easier for combining electronjs and ClojureScript. I saw a few figwheel related articles when googling cljsjs electron. Cljsjs doesn't seem to have electron, but it sounds like someone has packaged electron up as a foreign lib with externs themselves.

Abhinav Sharma05:08:42

Thanks @U05254DQM! I do like shadow-cljs as well, but have not been successful in setting up spacemacs properly with it in the past. I would love to have this same experience for development with shadow-cljs like figwheel provides

practicalli-johnny09:08:18

Ah yes, looking through https://shadow-cljs.github.io/docs/UsersGuide.html there is quite a bit to set up. I wonder if anyone has created a project template. I am interested in setting up shadow-cljs with the Clojure CLI tools (deps.edn) and getting that to all run from CIDER. I'll try find a day to work on that but it will be after my charity ride (so late September).

practicalli-johnny09:08:38

If you can find a working electron via Cljsjs, that should be easier, just adding it as a dependency to your figwheel project. You may want to avoid advanced compilation if you are getting a lot of errors.

Abhinav Sharma07:08:31

Thanks for always being so helpful @U05254DQM 😊 ! Let me give some time to this setup sometime this week and circle back to you on the progress, the article does clear out a few doubts I had about the reloadable code, which is ideally what we want in the electron-cljs workflow as well