shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
Eugen 2020-11-21T00:23:01.164Z

my main issue right now is to disable minification for some function: init, enable and disable. gnome shell calls those function to do the work. But the current setup minifies those names.

2020-11-21T01:13:34.165400Z

I'm getting

[2020-11-20 20:08:05.240 - INFO] duplicate resource com/fulcrologic/fulcro/mutations.cljc on classpath, using jar:file:/home/buidler/.m2/repository/com/fulcrologic/fulcro/3.4.3/fulcro-3.4.3.jar!/com/fulcrologic/fulcro/mutations.cljc over file:/home/buidler/project/src/app/com/fulcrologic/fulcro/mutations.cljc
But I don't understand why. I want to use my file, not the version in the jar file. Looking at these instructions https://shadow-cljs.github.io/docs/UsersGuide.html#_patching_libraries

thheller 2020-11-21T10:32:09.171500Z

which version is this? it should be using the file not in the jar always but that kinda depends on which version you use?

2020-11-21T12:19:58.172100Z

thheller/shadow-cljs {:mvn/version "2.8.107"}

thheller 2020-11-21T12:33:37.172300Z

yeah thats rather old. dunno how it was handled back then. try 2.11.7

thheller 2020-11-21T12:34:18.172600Z

also when you use tools.deps it kinda depends which version you are using there

thheller 2020-11-21T12:34:26.172800Z

there was a version that didn't sort :paths first

2020-11-21T13:15:29.178900Z

Should I be concerned much about a shadow-cljs upgrade breaking my application in some way?

thheller 2020-11-21T14:56:04.179500Z

since the upgrade also involves upgrading CLJS and the closure-compiler that can always happen

thheller 2020-11-21T14:56:24.179700Z

don't know what you are doing so can't rule it out

thheller 2020-11-21T14:56:35.179900Z

but most of the time the upgrade is smooth and without issues

2020-11-21T01:14:38.165600Z

:paths ["src/app" "resources" "src/test"]

Eugen 2020-11-21T01:34:12.167200Z

I made a Gnome Extension with ClojureScript that does nothing useful !!! thanks @thheller for support 🙂

Eugen 2020-11-21T01:35:30.168300Z

I need to clean up the code and then submit a proper PR and document it

2020-11-21T01:43:43.168400Z

I think I got it. Looks like I have to restart shadow-cljs whenever there's a modification.

srihari 2020-11-21T06:53:11.170300Z

Hey there 👋 I’m building an app that requires an in-browser-evaluator, and so, I’m using the shadow-cljs-bootstrap functionality. I’ve mostly followed the https://code.thheller.com/blog/shadow-cljs/2017/10/14/bootstrap-support.html. I’m having trouble creating a release of my app with the bootstrap target. I get a “goog is not defined” error. Works in dev mode. Not sure what I’m missing.

thheller 2020-11-21T10:33:18.171700Z

the app build must use :compiler-options {:optimizations :simple}

thheller 2020-11-21T10:33:31.171900Z

for release to work

srihari 2020-11-21T12:48:26.173200Z

Yeah, I tried that as well. I also mentioned that above. Same error, “goog not defined”.

thheller 2020-11-21T12:49:59.173400Z

well goog is not defined is what you get when it is :advanced and not :simple

thheller 2020-11-21T12:50:11.173600Z

so might have been in the wrong place or had a typo or so

srihari 2020-11-21T12:52:59.173800Z

Hrm, double checking.

srihari 2020-11-21T12:56:04.174100Z

Yeah, same error. Not sure what I’m missing: https://github.com/nilenso/in-browser-evaluator/blob/master/project.clj#L30-L45

thheller 2020-11-21T12:57:57.174400Z

assuming you are loading /js/compiled/app.js in your HTML? I mean where exactly do you get that error?

thheller 2020-11-21T12:58:09.174600Z

oh wait .. I know sorry

srihari 2020-11-21T12:58:19.174800Z

thheller 2020-11-21T12:58:20.175200Z

you also need :output-wrapper false in the compiler options

srihari 2020-11-21T12:58:38.175400Z

In app or bootstrap-support?

thheller 2020-11-21T12:58:43.175600Z

app

srihari 2020-11-21T13:01:18.175800Z

💯

srihari 2020-11-21T13:01:33.176Z

Just read up about the output-wrapper in the user guide as well.

srihari 2020-11-21T13:02:20.176200Z

Thanks @thheller ❤️

srihari 2020-11-21T13:02:38.176400Z

And thank you for making shadow-cljs 🙇

srihari 2020-11-21T13:03:19.176600Z

Might be worth adding this as a note in the blog post, or in the user-guide, perhaps.

thheller 2020-11-21T13:03:48.176800Z

yeah just added it to the blog post 🙂

srihari 2020-11-21T13:03:57.177Z

👌 that was quick

srihari 2020-11-21T06:53:49.170500Z

Here’s my project.clj: https://github.com/nilenso/in-browser-evaluator/blob/master/project.clj

srihari 2020-11-21T06:55:08.170900Z

I’ve tried setting compile options to :optimizations :simple . That doesn’t work either.

srihari 2020-11-21T07:00:04.171100Z

If I compile app and bootstrap-support separately in dev mode, it works. i.e shadow-cljs compile app bootstrap-support .

srihari 2020-11-21T13:04:58.178Z

@thheller while I have you here, another question: I would like the compiler state to be refreshed every time I run eval. Is there a way to do this?

thheller 2020-11-22T09:39:54.180300Z

well as I said you can reset the compiler state

thheller 2020-11-22T09:40:39.180500Z

but you cannot reset the JS runtime state so you can create (defn foo [] ...) will create cljs.user.foo = function() ... . resetting the compiler state will remove the definition from the analyzer

thheller 2020-11-22T09:40:54.180700Z

(foo) will then result in a warning but it eval'd will call the old cljs.user.foo

thheller 2020-11-22T09:41:39.180900Z

well technically you can also reset cljs.user I guess

srihari 2020-11-21T13:05:34.178100Z

Right now, I’m hacking this by using a different namespace for every eval 😛

srihari 2020-11-21T13:06:31.178300Z

But that hack is coming apart now, so I’d rather fix it the right way.

srihari 2020-11-21T13:06:57.178500Z

Seems like I might have to run boot/init to refresh every time?

srihari 2020-11-21T13:07:19.178700Z

But I remember trying that, and not succeeding.

thheller 2020-11-21T14:54:39.179100Z

I don't know what you mean by "compiler state to be refreshed"?

thheller 2020-11-21T14:55:10.179300Z

I mean you can reset the compiler state but that doesn't reset the runtime state so that wouldn't do much