Fork me on GitHub
#shadow-cljs
<
2018-11-15
>
claudiu11:11:04

Trying to run a old project on a new machine and getting this:

claudiu11:11:05

npx shadow-cljs watch server 
shadow-cljs - config: /home/claudiu/clojure/fulcro-nodejs-ssr-example/shadow-cljs.edn  cli version: 2.7.3  node: v8.11.0
shadow-cljs - starting via "clojure"
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: comp/*source-map-data-gen-col* in this context, compiling:(shadow/build/compiler.clj:455:13)

claudiu11:11:16

any idea what it could be ?

claudiu11:11:56

solved... strange one. Updating clojurescript 1.10.339 to 1.10.439 fixed the error

thheller12:11:47

@claudiu 2.7.x depends on cljs 1.10.439 yes. since cljs added that backwards incompatible change older versions don't work anymore

claudiu12:11:43

was initially using shadow-cljs 2.6.7 and got the error. 🙂

thheller12:11:17

well the reverse is also true. 1.10.439 can't be used <2.7.0

claudiu12:11:43

by the way... big big thank you for the shadow-cljs + node.js stuff. Really awesome dev experience 🙂

😎 4
claudiu12:11:09

Don't know how much you're using fulcro & nodejs. But getting SSR with data from the network is like really easy & not much code overhead (nice experience on first load + refresh) 🙂 added a demo app https://github.com/claudiu-apetrei/fulcro-nodejs-ssr-example

thheller12:11:37

cool. just one minor nitpick. separating src/main/app and src/main/server is not necessary. namespaces already split the code enough and server code won't be included in the app build

thheller12:11:01

but if you like working like that it is fine to do this

thheller12:11:06

just not necessary

claudiu12:11:40

Ahh yep, just a personal preference to keep the sever & app code in separate folders :) for this demo app just copy pasted the structure from another project :)

thheller12:11:17

how do you deal with shared code? extra folder?

thheller12:11:38

ah nvm its already sharing the app folder.

claudiu12:11:03

Yep. Named it app (instead of client) so all the client + shared should code should be there. Only the server should import from app.

claudiu13:11:49

if you want sure 🙂

claudiu07:11:57

@U05224H0W Actually think it's better to not. It is just a proof of concept for fulcro SSR and I don't really think that express.js is the way to go. Will probably build an example app with nodejs+fulcro+pathom+code-splitting that uses https://macchiato-framework.github.io/ with a bit more app code, that one should be a nice addition for the shadow-cljs examples page.

Malte13:11:04

Hi, I'm using the :npm-module target (for now in convenience mode) to include some cljs into an existing JS project. I know that I can 'hot reload' the cljs code into the JS code base using shadow-cljs watch npm, but is it also possible to use a cljs repl with that target? I've tried using cider and manage to start a cljs repl, but everytime I try to eval something it tells me that the application hasn't connected to the REPL server. I've tried navigating to (which works), but this doesn't connect. Is connecting via browser even possible with :npm-module?

thheller14:11:40

@li1 since :npm-module does not have a clearly defined entry the devtools cannot be injected automatically

thheller14:11:47

you can set :runtime :browser in the config

Malte15:11:25

so something like

{:source-paths
 ["src"]

 :dependencies
 []

 :runtime :browser

 :builds {}}
?

thheller15:11:56

:builds
{:npm
 {:target :npm-module
  :runtime-browser
  :output-dir "node_modules/shadow-cljs"}}

thheller15:11:08

that would be identical to the "convenience" mode

thheller15:11:15

oops :runtime :browser

Malte15:11:21

this works, awesome! 🙂

Malte15:11:31

is the runtime flag documented somewhere?

thheller15:11:05

don't think so

Malte16:11:47

oh, and if this really proves to be unreliable with my setup, the fallback would basically be to write cljs without a repl and to restart my JS build server every time it needs to pick up changes? or is there something in-between?

thheller17:11:27

it all depends on how much the JS is processed. don't know enough about your setup to comment really

Malte18:11:51

OK, thanks a lot, this really helped me

thheller14:11:07

and then require("shadow-cljs/shadow.cljs.devtools.client.browser") somewhere in your JS

thheller14:11:50

that also enables live-reload not just the REPL

thheller14:11:15

but its not super reliable. depending on which other build tool you are using for JS