Fork me on GitHub
#shadow-cljs
<
2021-11-12
>
tony.kay02:11:56

I have badness for latest Shadow 2.16.3 on linux. Definitely breaks the build. Unfortunately it breaks at a macro and the error is very strange...going to try clearing all the caches

tony.kay02:11:26

seems like 2.15.13 has the same problem

thheller06:11:45

@tony.kay define badness? if its related to goog.object in any way its most likely this https://clojurescript.org/news/2021-11-04-release. can easily happen if the macro emits direct calls to anything goog.object

tony.kay13:11:42

So, I'm using goog.object in those nses, but I do require it. So I'm confused. It is a CLJC file, the CLJS side requires goog.object, and then the CLJS side of the macro emits goog.object/get. Is there some trick I'm not aware of?

tony.kay13:11:01

(it never occurred to me to not require something I was using from goog)

tony.kay13:11:39

The line it is crapping out on looks like this in js:

var G__83387 = com.fulcrologic.rad.rendering.semantic_ui.report.goog$module$goog$object.get(props__55942__auto__,"fulcro$value");

tony.kay13:11:12

Ah, so if I require goog.object in the ns that uses the macro it works...

tony.kay13:11:46

but that's a really crappy user experience for a library. My lib ns requires goog.object, but now the users of that ns have to require it too? That cannot be right

tony.kay13:11:50

but I sorta guess this would be a Clojurescript bug, and not a shadow-cljs one. Here's what I know so far if you want to look into it: Fulcro has a macro that emits goog.object calls. It is a CLJC ns, and goog.object is required in a reader conditional for the cljs side. When I use that from a CLJS file in a project it seems to work fine; however, when I use the base CLJC file in a dependent library that also defines things in CLJC, then the usage of that macro fails to see goog.object and it resolves to the wrong symbol (e.g. here is the line of js):

var G__83387 = com.fulcrologic.rad.rendering.semantic_ui.report.goog$module$goog$object.get(props__55942__auto__,"fulcro$value");
This is reproducible using this branch of the new fulcro-rad-template: https://github.com/fulcrologic/fulcro-rad-template/tree/latest-cljs Compile the main target and look at the js file com.fulcrologic.rad.rendering.semantic_ui.form.js or com.fulcrologic.rad.rendering.semantic_ui.report.js. They both have the problem. But I tried upgrading the compiler on Fulcro itself and running the simlple todomvc that exists in that project, and when used as cljs the macro seemed to work ok (in all cases the defsc macro from components is the one that is behaving strangely).

tony.kay13:11:46

Should I define my own CLJC function that calls goog.object/get, and not refer to it in the macro at all?

tony.kay13:11:02

Actually, that fixes it...so, macros just cannot ever safely emit calls to goog.object now, even if the ns the macro is in requires it?

thheller13:11:52

yeah its kind of annoying. I disagree with David's choice of adding the :global-goog-object&array compiler options to work around the issue but I guess we have to make this transition at some point so best to get it over with

thheller13:11:07

basically you cannot generate any code in a macro directly accessing the closure library namespaces in a macro anymore

thheller13:11:22

always need a helper function in a CLJS ns that calls them from now on basically

thheller13:11:03

you can use unchecked-get and unchecked-set instead of goog.object/get&set

tony.kay14:11:30

ok, then my fix is the official fix. Thanks for the help!

thheller06:11:24

the big thing was the cljs + closure compiler + closure library upgrade so sort of expected some breakage there

tony.kay12:11:44

in fact it is....I'll read up o nthat, thanks

FlavaDave17:11:45

have a react-native project running with shadow and everything works except the server running on localhost. console says main.js:1 Uncaught SyntaxError: Identifier 'Ca' has already been declared

Drew Verlee18:11:03

Is it possible to make changes to the shadow-cljs.edn without changing the file directly. E.g } want to add re-frame-10x to my personal workflow but not add it to the projects (commit it to github).

localshred18:11:13

You can use --config-merge EDN:

localshred18:11:16

$ shadow-cljs --help
...
      --config-merge DATA  merges additional EDN data into the build config

👍 1
Drew Verlee19:11:49

that's perfect!

localshred21:11:35

excellent 🙂