Fork me on GitHub
#shadow-cljs
<
2020-07-12
>
Yehonathan Sharvit13:07:20

Hello there, is there a way with shadow-cljs to compile a cljs lib into a js bundle for the browser?

thheller15:07:23

@viebel whats the difference to compiling a cljs app?

Yehonathan Sharvit15:07:53

I am not sure. Maybe the fact that there is no entry point

thheller15:07:40

you need to be more precise and describe what exactly "js bundle" means for you. there is always an entry point, even a lib will have at least one ns you'd use

Yehonathan Sharvit15:07:31

A ns could be set as entry point. No need for a specific function?

Yehonathan Sharvit15:07:21

By “js bundle” I mean that if I load this file in the browser, all the function of my lib are defined and callable

thheller15:07:36

defined and callable by what?

thheller15:07:06

the usual ^:export will make everything defined and callable. you can have as many of those in your lib as you want.

thheller15:07:56

I guess I'm confused by the "lib" aspect. not sure what that means to you.

Yehonathan Sharvit15:07:44

The use case is for libs that are not self host compatible, to make them usable in a Klipse snippet

Yehonathan Sharvit15:07:56

I don’t need advanced compilation

Yehonathan Sharvit15:07:18

I don’t want to force lib author to add ^:export to all the lib functions

thheller16:07:15

so you are talking about CLJS libs being used by self-hosted CLJS? that would be a no then.

thheller16:07:32

I mean there is https://code.thheller.com/blog/shadow-cljs/2017/10/14/bootstrap-support.html and you could in theory just compile all libs you want to be available together

thheller16:07:50

but other than that there is no support for any other self-hosted stuff and you kinda need to write that yourself