Fork me on GitHub
#clojurescript
<
2020-05-14
>
didibus04:05:47

Anybody gets a: REPL eval error TypeError: "goog.dependencies_ is undefined" when using figwheel-main ?

Oliver George06:05:08

Wild guess but I think figwheel is incompatible with the more recent CLJS release. That's close to fixed - might be worth trying an older CLJS version to see if it goes away.

didibus06:05:24

Hum, that might be it

didibus07:05:24

That was it 😄, went back 1.10.5.. and everything is much smoother now

Oliver George07:05:26

Good stuff. I think a fix is close based on the #cljs-dev chatter.

didibus05:05:05

Any rum compatible locally scoped CSS lib? Like if I want to define CSS style which applies to my whole rum component only?

Aron06:05:51

what do people use for formatting dates in cljs?

Aron06:05:17

I feel my best bet is to just use date-fns as in js

orestis06:05:58

Browser support seems decent. I haven’t used it though. date-fns is decent I guess.

thheller07:05:47

I'd just use the closure-library, it usually has enough. A bit hard to discover the docs though.

Aron07:05:11

oh, i keep forgetting there are things from google built into cljs

kimim08:05:40

Hello all, when I use https://github.com/r0man/cljs-http/ to send a post, with :json-params, the request is always turns into a OPTIONS request. Anyone know how to solve this issue? Thanks. (go (prn (:body (<! (http/post "" {:with-credentials? false :json-params {:a :b}})))))

thheller08:05:10

@kimi.im the browser will ALWAYS do an OPTIONS request first when talking to a different origin than the original page. this is done to do CORS checks to see if the server allows doing the actual request. see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

kimim08:05:25

But is I change the code without json-params, it will send a correct POST and get the response: (go (prn (:body (<! (http/post "" {:with-credentials? false :body "test"})))))

thheller08:05:40

are you sure its related to :json-params? you also changed the URL?

kimim08:05:35

sorry, the url is same, i just change it in previous message to remove some confusings.

thheller08:05:44

read about CORS. the server you are talking to there might just handle the OPTIONS request correctly.

thheller08:05:18

it has nothing to do with cljs-http and every other library will have that behavior as well

victorb10:05:53

is there any concurrency considerations with using binding and dynamic vars? Had a issue where a function is using a dynamic var that is bound outside the function call, and called concurrently with the same function but different bindings, and sometimes it seems like it's using the wrong binding

aisamu12:05:37

Bindings are lost across thunk boundaries:

(def ^:dynamic value 1)

(println value)

(binding [value 2]
  (println value))

(binding [value 3]
  (js/setTimeout #(println value) 0))
This prints 1 2 1

victorb13:05:07

hm, might be the issue, will dive deeper. Thanks a lot for the pointer!

dominicm11:05:17

I think bindings are thread local. You might want to use bound-fn

victorb11:05:22

hm, that would only apply to clojure, not clojurescript, right? In the issue I hit, it seemed binding was not local to the body, if execute concurrently. But I have yet to make a minimal reproducible case, so can't say for sure

dominicm11:05:55

Didn't see where I was, oops

😉 4
thheller14:05:48

binding really does not work in an async context

fmnoise14:05:31

Hi! Does anyone have an example of using .cookies for setting "SameSite"?

bhauman14:05:38

If folks want to experiment with the new :bundle target in CLJS and figwheel-main, I’ve just release [figwheel-main 0.2.5] with supports the :bundle target in [clojurescript 1.10.764]. Docs are shy but you can reference the https://clojurescript.org/guides/webpack to get a gist of how to get things setup.

parens 32
athomasoriginal16:05:26

Went through this yesterday. Currently using latest Figwheel and CLJS to build out a web app. Great stuff so far!

athomasoriginal16:05:57

Something I did notice, which I imagine will trip up new users, is that if one were to follow the webpack guide exactly with figwheel they will hit a wall because of the :output-dir and :output-to dir being customized in the webpack guide. Just a note for when the docs become a priority 🙂

bhauman18:05:55

@U6GNVEWQG thanks, things are still evolving, 0.2.6-SNAPSHOT is available and it fixes some bugs, but it will be changing over the next few weeks

athomasoriginal22:05:52

Nice. Will check this out now.

fenton18:05:27

can't get the output -o option to work with clojurescript compiler?

╭─fenton@dell ~/projects/supps ‹fenton*› 
╰─$ find . -name "*main.js*"
./out/main.js
╭─fenton@dell ~/projects/supps ‹fenton*› 
╰─$ rm -rf out/main.js             
╭─fenton@dell ~/projects/supps ‹fenton*› 
╰─$ find . -name "*main.js*"
╭─fenton@dell ~/projects/supps ‹fenton*› 
╰─$ clj -m cljs.main -c supps.core -o blah.js
                                             
╭─fenton@dell ~/projects/supps ‹fenton*› 
╰─$ find . -name "*main.js*"                 
./out/main.js               
╭─fenton@dell ~/projects/supps ‹fenton*› 
╰─$ find . -name blah.js 
╭─fenton@dell ~/projects/supps ‹fenton*› 
╰─$ 

dnolen18:05:02

@fenton I just tried it here w/ master it works for me

fenton18:05:08

ah i see ordering matters...

dnolen18:05:22

everything is left to right

fenton18:05:22

-c should be last

dnolen18:05:42

clj -m cljs.main -h is very illuminating about usage

dnolen18:05:34

`The init options may be repeated and mixed freely, but must appear before any main option.`

fenton18:05:41

right, skipped the part Usage: java -cp cljs.jar cljs.main [init-opt*] [main-opt] [arg*] where init options come before main options

Lone Ranger23:05:20

Can anyone recommend a good code splitting guide? I'm using webpack and figwheel-main to get work done. Are we supposed to do as much code splitting as possible with webpack for our node deps or do we somehow use figwheel+cljs to code-split out the webpack dist?