Fork me on GitHub
#clojurescript
<
2022-03-19
>
pinkfrog13:03:20

Hi. I come across this gist: https://gist.github.com/eval/f1aaab653927d39ec549f14defb21785 which prints message out only when optimization is disabled. How come optimization affects the behavior?

p-himik13:03:09

Chances are, it has nothing to do directly with optimizations and instead depends on the value of goog.DEBUG. Whether it's set to true or false depends on your build tool and configuration.

p-himik13:03:17

And if you do need to have goog logging in production, you can set goog.log.ENABLED to true via your build tool's config.

pinkfrog13:03:35

but How do i know the default value?

p-himik13:03:25

The default value is set to true in the sources. But I can't find what would set it to false, given that you're using default CLJS compiler, without any extra tools.

p-himik13:03:52

Maybe GCC itself sets goog.DEBUG to false when optimizations are not none, but I can't find that code.

pinkfrog13:03:10

Yup. That’s mysterious.

Ty16:03:53

Hey, folks. Been doing a bunch of work outside of the cljs world. Mostly using vite for building/dev and then vercel for deploying. I like my current setup for my other projects and was hoping to start a new cljs project and have the same sort of experience. Getting started on a project in cljs has always been the most challenging thing about the ecosystem. I was hoping to get a good template going for myself and do a nice writeup on my blog about it so that others can skip over the initial stress of figuring out which stuff to use. Is there any chance someone has some pointers for me?

Ty17:03:11

I think the vercel piece will just fall into place easily if I have a good dev setup with a simple to use/understand build command. A bit unsure about how the serverless functions would work but I'm guessing someone has done something like this before?

valtteri17:03:26

Hi, in Clojure(Script) ecosystem the tendency is indeed that there are many useful tools and libraries out there and the challenge is to find the ones that fit your needs / preferences and hook them up together. If you could describe a little bit what are you going to build and where/how do you want to run it and I can probably give some pointers. :)

valtteri17:03:40

About serverless.. There a couple of ways how to do it: • use a build tool (e.g. shadow-cljs) to compile CLJS to JS with node target (this is the usual approach). Then you just ship the JS code to the platform • use nbb (which is an npm module) to evaluate CLJS files on the fly on node runtime. With this approach you can use any build tool/system from the NodeJS ecosystem and you don’t need any additional tooling (this is quite a new thing but it works)

Ty17:03:05

Sure! Thanks. My goal is to build a web app to help musicians explore music theory and musical ideas in new ways. Generate new ideas, record snippets quickly, etc. For now I just need to get a pretty standard web app up and running. SPA style is fine, but if possible I'd really prefer to have something with built in SSR and filesystem-based routing. SvelteKit is what I've been using recently, but I think Next/Nuxt are built on the same principles. For server-side stuff I have a while before it matters. Eventually it will matter and I do want to make sure I'm setting myself up for success when the time comes. So as long as the build tool/setup is flexible enough to support doing some serverless function stuff I should be good to go. (the nbb setup above sounds like a winner!)

valtteri17:03:38

Sounds like a neat project, cool! Do you prefer AWS / Google Cloud or any other particular hosting provider?

Ty17:03:12

Yeah I'm trying to go with Vercel.

valtteri17:03:52

Sadly I know nothing about Vercel. 😕 Take a look at https://github.com/chr15m/sitefox

valtteri17:03:18

It sounds quite much what you’re describing. I haven’t tried it myself though.

valtteri17:03:10

I don’t know of other “batteries included” framework-y kind of things. Probably there’s something more but perhaps someone else could chime in..? With that kind of approach you should up to speed quickly. Another option is to look for individual libs/tools that you would like to use and then figure out how to make them work together. It might be more tedious in the beginning though but there’s help available (here, Clojureverse). Third option, which is kinda wildcard, is to stick with your favourite NodeJS framework & tooling and use nbb to write the code in CLJS instead of JS. 🙂