Fork me on GitHub
#shadow-cljs
<
2019-01-12
>
thheller11:01:57

@davidcerezoinigo I generally recommend staying away from environment variables for builds since they are typically abused for something that should be runtime configuration to instead be used for build configuration

πŸ‘ 5
thheller11:01:17

but you can use the reader macro #shadow/env "THE_KEY" in the config

thheller11:01:41

:closure-defines {some.thing/foo #shadow/env "FOO"}

Jon12:01:15

run into several issues when I was introducing shadow-cljs to my friend today. not confirmed. 1. when :target :node-script is used with :modules {:main {:init-fn a.b/c}}, I saw no warnings on running shadow-cljs.edn. 2. ":after-load x.y/reload" is written in the configs while the real namespace is a.b/reload, 3. I added ["fs" :as fs] and save file, is how replaces and import fs. however it throws an error. restarting the process then it will be ok.

thheller12:01:05

@jiyinyiyong I don't understand what you mean with 3.? what error does it throw?

Jon12:01:36

didn't note down that error.

Jon12:01:05

something looked like couldn't find that namespace

thheller12:01:53

I'm gonna need a full error report and preferably reducible example. I'm not going to try and guess what you were seeing

thheller12:01:17

1/2 are known. Configs need more validation.

Jon12:01:37

okay. I would copy the error messages next time I see it.

Chase19:01:39

hello! I'm trying to do the free reagent course but using emacs/cider instead of atom. can someone please take a look at the project's shadow-cljs.edn file and help me switch out proto-repl so that I can use cider. I keep getting errors when trying to connect the repl about my middleware. https://github.com/jacekschae/learn-reagent-course-files/blob/master/giggin/shadow-cljs.edn

thheller19:01:27

@chase-lambert you just take out the proto-repl and add cider-nrepl with the version matching your cider config

Chase19:01:11

i thought that was it but maybe i'm using the wrong version. let me find out how to check my cider config

thheller19:01:45

does it not tell you on connect? I thought it used to

thheller19:01:46

there are some instructions here but I don't know how current they are. cider seems to be changing a lot. https://shadow-cljs.github.io/docs/UsersGuide.html#cider

Chase19:01:02

do i want to use shadow or shadow-select if I've already got the server running?

Chase19:01:36

cider does change a lot! I also failed to set my config to only use cider stable. this tech game is hard for me this week!

thheller19:01:42

not sure I understand what you mean by "shadow or shadow-select"

Chase19:01:38

ahh. when you connect-cljs in cider it asks for host, port, and then Clojurescript repl type. it has two options for shadow-cljs. shadow and shadow-select. Then it also asks for build type so I select dev and it gives me this error:

WARNING: No Clojure project was detected. The
refactor-nrepl middleware was not enabled. (You can mute this
warning by customizing `cljr-suppress-no-project-warning'.)
shadow.user> ExceptionInfo no build with id: :dev  clojure.core/ex-info (core.clj:4739)WARNING: No Clojure project was detected. The
refactor-nrepl middleware was not enabled. (You can mute this
warning by customizing `cljr-suppress-no-project-warning'.)
shadow.user> ExceptionInfo no build with id: :dev  clojure.core/ex-info (core.clj:4739) 

thheller19:01:15

the build is called :app if you are using the default giggin config

Chase19:01:22

hmmm, ok. still didn't work but it's a little different. Cider is telling me this: CIDER 0.20.0snapshot (package: 20190112.721), nREPL 0.4.5 but if I put that in the dependencies instead of [cider/cider-nrepl "0.19.0"] I get a dependency error when starting the server

thheller19:01:48

put in what?

Chase19:01:49

WARNING: No Clojure project was detected. The
refactor-nrepl middleware was not enabled. (You can mute this
warning by customizing `cljr-suppress-no-project-warning'.)
shadow.user> To quit, type: :cljs/quit
[:selected :app]
cljs.user> 

thheller19:01:14

that looks correct now?

Chase19:01:32

but it says shadow-cljs - connection closed still on the browser. what's a simple expression I can throw in the repl to see if it's working? something like (js/alert "It's working!")?

thheller19:01:59

it probably still fails to connect due to your strange VM setup

thheller19:01:29

the browser is trying to connect to the shadow-cljs process via websocket

Chase19:01:34

oh. damn that is frustrating. I have it open in both my linux "container" and my regular os.

thheller19:01:43

and that likely is the problem here

thheller19:01:50

open the browser console and check what it says

Chase19:01:38

wait it worked! It is in my linux browser but the bottom left corner is just blank instead of the green shadow-cljs connection open or whatever I thought it would be. Sweet!

Chase19:01:06

thanks again for helping me out. I know i'm probably making things overly difficult. But boy howdy is it frustrating to not even be able to get set up. I'm learning though.

thheller19:01:00

can't comment on cider anymore. I quit using it a long time ago, got too tired of it breaking πŸ˜‰

Chase19:01:17

what do you use now?

hueyp20:01:45

I’m getting a compile warning

------ WARNING #5 --------------------------------------------------------------
 File: xxx/animate.cljc:34:21
 variable ReactTransitionGroup is undeclared
--------------------------------------------------------------------------------
it seems to closure optimize fine when I grep the output … but I’m worried I’m missing what its warning me about πŸ™‚

hueyp20:01:57

this is during a release build

hueyp20:01:50

this is with infer externs / npm package react-transition-group and doing the cljsjs hack of (js/goog.exportSymbol "ReactTransitionGroup" react-transition-group) (we’re still migrating …)

hueyp20:01:34

similar warning with Raven -- compiled output: https://gist.github.com/eyston/9b60e0896bb344ffd4055637d79e6a48 β€” I think that sa is the goog.exportSymbol 😜

hueyp20:01:12

so it gets all the externs right, it just seems upset at the top level even tho the exportSymbol is right there

thheller21:01:00

@U0KHZ4HNG where or how do you access the ReactTransitionGroup?

hueyp21:01:16

js/ReactTransitionGroup.CSSTransition

hueyp21:01:24

(js/React.createElement
            js/ReactTransitionGroup.CSSTransition
            (clj->js props)
            #(f (keyword %)))

hueyp21:01:45

also β€” this warning is before the final output β€” like I get two groups of warnings, its in the first

thheller21:01:49

hmm that alone should prevent that warning?

hueyp21:01:56

if that matters (or whats the distinction between the two sets?)

thheller21:01:13

closure optimization warnings are separate from cljs compiler warnings yes

hueyp21:01:14

that was my understanding of the extern infer guide β€” js/* should be fine

hueyp21:01:38

well .. they are both during closure I think? at least it seems that way … or maybe I’m misinterpreting

hueyp21:01:07

-> Closure - Optimizing ...
------ WARNING #1 --------------------------------------------------------------
 File: com/cognitect/transit.js:649:8

 variable module is undeclared
--------------------------------------------------------------------------------

hueyp21:01:23

this is the first group, and it happens after the Closure - Optimizing ... step

hueyp21:01:27

and the second group is after …

thheller21:01:30

yeah that is one known

hueyp21:01:38

[:widget] Build completed. (437 files, 303 compiled, 1 warnings, 75.64s)

------ WARNING #1 --------------------------------------------------------------
 File: om/next.cljc:493:4
--------------------------------------------------------------------------------

hueyp21:01:53

so the first group β€” thats the clojurescript compiler? second group = closure?

thheller21:01:35

first one is closure

thheller21:01:21

check if .shadow-cljs/builds/<your-id>/release/shadow.externs.js contains ReactTransitionGroup.

hueyp21:01:12

oh awesome, I was curious how to see what it infer’d πŸ™‚

hueyp21:01:42

uh β€” should everything be on ShadowJS.prototype.* ?

hueyp21:01:55

/** @const {ShadowJS} */ var FormData;
/** @const {ShadowJS} */ var PropTypes;
/** @const {ShadowJS} */ var React;
/** @const {ShadowJS} */ var requestAnimationFrame;
this is at the top, the rest is on ShadowJS β€” no ReactTransitionGroup

hueyp21:01:41

but it does have the externs for ReactTransitionGroup itself, e.g.

ShadowJS.prototype.CSSTransition;

hueyp21:01:34

some old cljsjs stuff might still be on our classpath if that could be an issue ;/

thheller21:01:14

no cljsjs is completely ignored

thheller21:01:25

doesn't matter if its on the classpath or not

hueyp21:01:13

we have our own extern file as well β€” would it be reasonable to add /** @const {ShadowJS} */ var ReactTransitionGroup; plus the handful of others not picked up?

hueyp21:01:55

it seems to pick up all the properties correctly which is all that will matter once we migrate away from the cljsjs shims

thheller21:01:20

not sure if you can add the externs def to your file. closure might complain.

thheller21:01:46

global:ReactTransitionGroup

hueyp22:01:20

:thumbsup:

hueyp22:01:30

thanks β€” sorry for taking up your time on just a warning 😜