Fork me on GitHub
#clojurescript
<
2019-01-28
>
idiomancy05:01:29

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

idiomancy05:01:35

i get a main.js

idiomancy05:01:41

but if I load it into a script tag

idiomancy05:01:49

i get o not defined stuff

lilactown05:01:23

:thinking_face: is this a dev or release build?

idiomancy05:01:52

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

lilactown05:01:47

do you have any external JS?

idiomancy06:01:13

yeah, it was some external js

idiomancy06:01:19

thanks! good tip!

idiomancy07:01:43

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?

lilactown07:01:46

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

lilactown07:01:55

makes 80% of the cases really easy

stathissideris09:01:52

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

idiomancy14:01:05

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

borkdude14:01:15

figwheel already reloads browser apps

idiomancy15:01:09

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

thheller15:01:44

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.

idiomancy15:01:17

yeah, thats exactly what I'm looking for!

idiomancy15:01:26

im having issues with npm dependencies

idiomancy15:01:46

so im looking to get some shadow involved

batoms15:01:37

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

batoms15:01:45

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.

batoms15:01:07

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

batoms16:01:26

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?

roman01la18:01:59

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

roman01la18:01:17

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

roman01la18:01:24

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.

roman01la18:01:23

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

roman01la18:01:14

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

roman01la18:01:22

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

roman01la18:01:04

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 http://Cypress.io 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.

aisamu14:01:34

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.

borkdude22:01:00

@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