Fork me on GitHub
#shadow-cljs
<
2020-06-05
>
Josh Horwitz01:06:44

Hey everyone! Was wondering if anyone had a writeup/documentation about porting a lein cljs project with project.clj over to shadow-cljs?

Chris McCormick01:06:05

no write-up but have done it a couple of times if you have any questions

Josh Horwitz02:06:40

Thanks! Just curious, what was your first step? which direction did you decide to go? Keep lein? remove? etcc.

Chris McCormick02:06:48

i did this on https://github.com/infinitelives/px3d as one example. started by simply creating a shadow-cljs.edn and package.json as if i was starting from scratch.

Chris McCormick02:06:12

i had done a few shadow-cljs projects by this time so that part was fairly straightforward

Chris McCormick02:06:38

once it was all up and running i could remove the project.clj though that isn't really neccessary

Chris McCormick02:06:12

i also wrap everything in a Makefile generally so i just modified the one i already had working

Josh Horwitz02:06:05

great, thank you so much!

Chris McCormick02:06:32

hey no problem at all hope it goes well!

David Pham09:06:49

Did anything happen to the shadow-cljs nrepl? I got some nullpointer exception whenever I am trying to make autocompletion with Cider

David Pham09:06:17

It works with 2.9.10 but not 2.10.1

thheller09:06:04

stay with 2.9.10 if you want cider auto complete for now. not sure I can or want to restore the not-public API it used before.

David Pham10:06:31

Thanks. So clj-suitable can actually change their API and it would work?

thheller10:06:35

that is what I'm trying to determine in the ticket. not actually sure what they need. I think the new API fn should cover everything.

thheller10:06:10

I'll see if I can restore the old stuff in some way but not sure I can. probably best to stay with 2.9.10 if you care about cider autocomplete

David Pham12:06:10

Thanks 🙂

Luca14:06:11

Hi I am trying to use this React component: https://github.com/christo-pr/dangerously-set-html-content , I am using Reagent. At the top I have:

(ns app.core
  (:require ["dangerously-set-html-content" :default InnerHTML]))
My component is:
(defn component []
  (let [html-str "blabla"]
      [:> InnerHTML {:html html-str}]))
I get this error in my JS console:
React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Thank you in advance for your time!

Luca15:06:21

Ok, I am pretty sure the InnerHTML reference is nil..

alpox15:06:18

I'm not sure what happens exactly but are there not a set of parantheses missing in the ns declaration?

(ns app.core
  :require ["dangerously-set-html-content" :default InnerHTML])
Should be:
(ns app.core
  (:require ["dangerously-set-html-content" :default InnerHTML]))
Not sure if it would work without the parantheses

Luca16:06:35

Sorry I did not paste the code correctly! The parentheses are there!

thheller16:06:00

@luca.cambiaghi try

(ns app.core
  (:require ["dangerously-set-html-content" :as InnerHTML]))

Luca16:06:13

@thheller awesome, that works! I feel stupid for not having tried it before! Thank you!!

kenny17:06:26

Every time I start shadow-cljs up, it sends a build error on this particular line:

50 |        #::table
----------------------^---------------------------------------------------------
No namespace: compute.ui.components.table found
The compute.ui.components.table is required in the namespace this error is in. Is there a known issue with namespace map syntax?

kenny17:06:53

If I go make a small change to the table ns, the error goes away. It will then find another place where the namespace map syntax is used and fail on that. For example

139 |        #::calendar{:value     selected-date
-------------------------^------------------------------------------------------
No namespace: compute.ui.components.calendar found

thheller17:06:47

this is not an error from shadow-cljs. maybe from the reader?

kenny17:06:56

Trying the latest version. Was on 2.9.8. Oh, yeah probably the reader.

kenny17:06:27

2.10.2 fixes it. Weird.

kenny17:06:51

Some sort of bug in the reader in between those versions. A bit surprising.

thheller17:06:08

there have been no tools.reader changes in those versions

thheller17:06:23

check your classpath. maybe you have some conflicts?

kenny17:06:59

Oh, perhaps. Will check. Latest shadow-cljs will print this warning to the console on reload: couldn't find custom :build-notify

thheller17:06:56

will be fixed soon. looking into something else before I make a new release

fabrao18:06:30

Hello all, I´ll deploy my first shadow-cljs project. I know that I´ll have to compile it with npx shadow-cljs realease app . But how do I pack the node_modules?

fabrao18:06:08

My node_modules has 270 Mb, do I have to copy it to my server?

thheller18:06:53

assuming you are talking about a :browser build you only need the files in the :output-dir

fabrao18:06:54

yes, :browser . If I did something like <link rel="stylesheet" href="node_modules/suneditor/dist/css/suneditor.min.css"> , copy it to the css asset?

fabrao18:06:53

there is cljs-runtime, do I have to copy it too?

thheller18:06:33

if you are referring to css files directly then you need to copy those

thheller18:06:55

the cljs-runtime dir is from dev builds (ie. watch). it is not produced or required by release builds.

fabrao18:06:40

so, only app.js?

thheller18:06:13

I don't know your :modules config. if you only have :modules {:app ...} then yes

fabrao18:06:49

:modules {:app {:entries [app.core]}}

fabrao18:06:20

so it will compress all the dependencies in one app.js ?

thheller18:06:22

yeah that produces a app.js in your :output-dir

fabrao18:06:45

thank you !