Fork me on GitHub

lol, so uh,m real dumb question. When I've compiled using the clj cli... how do i host that file?


i get a main.js


but if I load it into a script tag


i get o not defined stuff


:thinking_face: is this a dev or release build?


release build. theres a bunch of cruft in the file, my guess is a dependency on something that isnt being pulled in by deps


do you have any external JS?


yeah, it was some external js


thanks! good tip!


lol, speaking of foreign libs, I have no idea how to get them to work, even in the repl. npm dependencies - y u so hard?


yeah, most of my projects use a lot of npm libs so I use shadow-cljs for compilation


makes 80% of the cases really easy


what do people do to run cljs tests on a CI server when the project needs a dom?


is shadow cljs a figwheel-like autoreloading situation for browser apps?


figwheel already reloads browser apps


right, right. @borkdude I'm asking if shadow-cljs is a replacement for figwheel or something that works along side it


it is a complete replacement and does not work with figwheel. it does however provide it own life-reload functionality if that is what you are looking for.


yeah, thats exactly what I'm looking for!


im having issues with npm dependencies


so im looking to get some shadow involved


Has anyone had success using the date-fns 2.0.0-alpha library in clojurescript?


I can use :npm-deps to install it but requiring it seems to fail when it tries to resolve importing dependencies within the same package.


e.g. Error: Can't resolve './addDays/index.js' in '/Users/brett/devel/web'


Thanks @roman01la, that’s probably a better idea.

Matt Butler18:01:08

I'm referencing a global JS variable I require in via foreign libs (js/Plotly.react). In advanced compilation I'd expect this to be renamed by the closure compiler and therefore I'd need to provide externs. This doesn't appear to be the case and is there in my compiled js as above. Am I misunderstanding something :) I have infer externs on, I thought that just outputted them to inferred-externs.js, are they automatically used by the compiler at the same time?


The key here is that you add a lib as foreign libs


foreign libs never go through Closure, they are just prepended as is


to the output of Closure

Matt Butler18:01:17

But doesn't my clojure code which references that code go through the compiler?

Matt Butler18:01:53

And rename my ref thinking it can minify it.


aaah I see, yes if you have externs inference on it should to it automagically


you can do (set! *warn-on-infer* true) in a namespace with interop code and you’ll see more info during compilation

Matt Butler18:01:52

I see, I'm only referencing a simple top level variable so it makes sense it could infer it, I just didn't think it also used that inference automatically. I guess I'll have to re-read the docs


afaik inference was much improved in the last release

Matt Butler18:01:02

>A helpful facility for generating :externs whenever a . form is used on a type-hinted symbol ^js/Foo.Bar x. Enable warn-on-infer to be warned of failed inferences. Successful inferences are written to inferred_externs.js in :output-dir.

Matt Butler18:01:34

I guess the first part is what tells you it will be used


so if JS object is passed somewhere such as compiler can’t infer what is that you can annotate it with ^js and that should od the job

Matt Butler18:01:13

It will generate the value of the :externs option to the compiler

Matt Butler18:01:03

Which fits with the behaviour I'm getting so all good :) inferring meaning can be hard sometimes, thanks :)

Mario C.22:01:26

Has anyone used in their Clojurescript project? I am looking into using it but I don't really have a good idea on how to get started with it. Should I just stick with Selenium? I basically just want to automate a series of steps I do every time make changes e.g Go to localhost:3449, click on a checkbox, select from a dropdown, type in a word, etc.


Yup, driven from webpack (using shadow-cljs). It's considerably nicer than selenium, but it's not without its own quirks. And so is etaoin, used on a separate project. In the end you're still at the mercy of the browser+js behavior.


@mario.cordova.862 I know figwheel has automatic CLJS tests on change. I use etaoin for automated browser testing.

Mario C.22:01:06

@borkdude This is actually seems better, thank you