Fork me on GitHub
#shadow-cljs
<
2021-08-11
>
haywood18:08:47

Anyone know why you can’t use an :advanced compiled :bootstrap host? I’m trying to figure out a work around but it’s not clear why it breaks down after advanced compilation.

thheller18:08:51

simply not possible. :advanced renames everything, deletes stuff that is unused, inlines stuff, etc

thheller18:08:30

so the code produced by the self-hosted compiler works against names that no longer exist

haywood18:08:36

could I isolate the code that initializes the compiler and build it separately as a standalone js file and interact with it via interop?

thheller18:08:03

what would that do?

thheller18:08:50

I mean its not about the code that initializes the compiler, that part can be advanced compiled easily

thheller18:08:25

the code produced by the self-host compiler requires that to be :simple though

thheller18:08:53

or do you mean your "host" build? meaning your regular app minus the compiler?

haywood18:08:26

well, create like a mini host build that is essentially a couple of function to initialize and send strings to for evaluation

thheller18:08:03

sure but again ... to be able to eval at all you need to have all code present?

thheller18:08:26

so the "mini" host build is not that mini

haywood18:08:42

it’s okay if it’s big, only some users will hit this part of the application, but right now the entire app is penalized

thheller19:08:44

self-host is a kind of difficult beast

thheller19:08:08

but you can absolutely run a specialized self-host build in an iframe or so (different context is important)

thheller19:08:29

and the regular app stays small and :advanced

haywood19:08:20

interesting, okay cool

haywood19:08:42

thanks for the info, really appreciate it. I’m gonna just hack my way into it and hope for the best 😅

thheller19:08:32

important aspect is that the host build using the self-host compiler + bootstrap are itself :simple

thheller19:08:57

which can run in an iframe or webworker or so

haywood19:08:45

I was thinking I could lazy load that separate host from advanced compilation when the route is initialized

thheller19:08:24

I'd strongly recommend not loading it into the same context

thheller19:08:38

thats basically asking for trouble

thheller19:08:44

its possible but easy to mess up