Fork me on GitHub
#figwheel-main
<
2018-09-27
>
shaun-mahood03:09:24

@bhauman First attempt at Cursive documentation is PR’ed - if I have the time tomorrow I will try and tackle the combined project, let me know if you want anything changed (or feel free to change it yourself as desired). I’m planning to also get some screenshots and maybe a gif of the steps if I can figure out a nice way to do it.

jeluard08:09:24

Hey! I'm having issues using ^{:watch-dirs ..} when using extra-paths in my alias. Somehow first compilation fails and I get goog.require could not find: .. errors. Nothing specific in the REPL. Is there a way to access more logs to troubleshoot this?

jeluard08:09:08

Also figwheel log file is not generated.

jeluard08:09:23

Oh actually figured I have to put the whole paths in watch-dirs, not just the specific path I am interested with.

pesterhazy10:09:08

When I compile a production build with these settings:

:foreign-libs [{:file "../foo/bar.js",
                 :provides ["react"
                            "react-dom"
                            "create-react-class"
                            "react-dom/server"]
                 :global-exports {react React
                                  react-dom ReactDOM
                                  create-react-class createReactClass}}]
a funny thing happens: it creates a directory foo/ in the cwd and copies the files there

pesterhazy10:09:42

My expectation is that the compiler uses ../foo/bar.js. Is this because I'm using a file that is outside the cwd?

pesterhazy10:09:28

Not sure if it's figwheel or the cljs compiler that's doing that. The funny thing is that this doesn't seem to happen with dev builds

bhauman14:09:19

@pesterhazy yeah figwheel doesn’t do anything with these opts they just get apssed to the compiler, so you are looking at the compilers behavior

jstaab15:09:02

Hey there, is it possible to use figwheel-main to hot reload server code? If not, any suggestions how I might go about that?

pesterhazy15:09:00

@jstaab AIUI that's not figwheel's job (it's about ClojureScript). So figwheel is orthogonal to server-side reloading, and you can use the same techniques you'd use otherwise for reloading server code in a JVM that also runs Figwheel

jstaab15:09:19

Ok, thanks — I have more questions on how to do that in general, but I'll move this to the appropriate channel simple_smile. Any suggestions on where to take the discussion?

jstaab15:09:33

Does integrant do hot code reloading?

jstaab15:09:54

I guess maybe integrant/repl with something like hawk for watching files?

pesterhazy16:09:12

Integrant may be a good starting point yes

pesterhazy16:09:39

One thing to consider is whether you really want a file-watching based dev cycle

pesterhazy16:09:02

Usually with Clojure is super easy to just connect to the running repl and re-evaluate the current buffer

pesterhazy16:09:23

The advantage is that you get compile errors etc. right there in your Emacs buffer (or Atom or ....)

pesterhazy16:09:58

The final step then is to restart the web server, which is sometimes required (e.g. when you change the routes)

pesterhazy16:09:23

You can do that from repl too, or have some kind of hook that executes after reloading the buffer

jstaab16:09:27

Is there an example out there I could take a look at? I've never quite grokked the whole "live in the repl" lifestyle with lisps.

stathissideris19:09:43

It’s an excellent intro to the repl

jstaab16:09:03

And to clarify, file-watch based vs reload buffer from editor is just a matter of resources? or control of when/if something gets reloaded?

shaun-mahood16:09:56

@jstaab I've got integrant working nicely with figwheel-main - not auto-reload, but on each change it's easy to refresh with a command in the repl. https://skillsmatter.com/skillscasts/9820-enter-integrant-a-micro-framework-for-data-driven-architecture-with-james-reeves is a good video introduction for Integrant https://vimeo.com/223309989 is a good video for repl based development

jstaab16:09:52

I'll check those out, thanks

shaun-mahood16:09:50

@jstaab I've not experimented with it, but figwheel-main also has an option for reloading Clojure files - https://figwheel.org/config-options#reload-clj-files No idea how it would work for what you are looking for, though

jstaab16:09:38

I'm actually using shadow-cljs for my client-side stuff; I was only looking at figwheel-main because it was the word in my head associated with "hot reloading"

jstaab16:09:52

But maybe switching to figwheel would give me a more coherent setup

shaun-mahood16:09:55

If you're looking for server side, I think figwheel vs. shadow-cljs is probably the wrong place to spend time on - they are both pretty much concerned with the client side. I've been really happy with Integrant for the server side aspect but there are definitely other options (mount, component, etc).

jstaab16:09:56

Ok, Integrant is pretty nice, I think I'm almost to a working solution. And it seems like if I want to go file-watch mode, it should be easy to bolt onto the user.clj namespace

jstaab16:09:40

Thanks for the help!

👍 4