Fork me on GitHub
#shadow-cljs
<
2020-01-16
>
Bravi13:01:18

hi everyone. do we have a re-frame template for shadow-cljs? meaning something line lein new shadow-cljs +re-frame

thheller13:01:27

the re-frame template uses shadow-cljs I think?

Bravi14:01:24

nice 😄

darwin17:01:46

@thheller so there are only two loader modes? :eval (default) and :script (old one)

thheller17:01:57

yes

✔️ 4
thheller17:01:12

well :script technically has 2 modes

thheller17:01:41

async and actual <script> tags, depending on whether you use <script async src="the-module.js"> or not

thheller17:01:40

one uses document.write to add script tags, the other fetches files and evals them

thheller17:01:00

so probably has the same issues as :eval. never tested.

darwin17:01:16

I think both will work, the issue is probably that SHADOW_ENV.evalLoad is really running “anonymous” code which is not associated with any source file, so (logically) that source file is not created/tracked in the DevTools - devtools only creates “virtual” cljs files from sourcemap information (orange stuff in devtools resource tree)

thheller17:01:07

loading the source via fetch and eval'ing it is just as "anonymous"

thheller17:01:24

there is no way chrome ties the eval to the file it just fetched

darwin17:01:00

but just the fact that it fetched the url could add it into DevTools and cljs source reference would work

darwin17:01:11

(my guess)

thheller17:01:16

my guess is that it expects //# sourceURL= or something instead of just /js/cljs-runtime/foo.bar.js

thheller17:01:06

I can't remember if I ever tried this in a browser context. I tried it in react-native and that didn't work at all since you don't know the location

thheller17:01:26

I do remember that I played around with this a whole bunch ... wish I left more comments 😛

darwin17:01:42

🙂 this stuff is still in flux, there used to be pretty bad bugs in devtools sourcemap implementation for example, so stuff could have changed since you last looked

thheller17:01:25

thats possible too .. it has been 2 years or so since I implemented that

darwin17:01:33

there are still issues between mapping locals, but it is low priorty for them to fix: https://github.com/binaryage/dirac/issues/53

thheller17:01:28

yeah its pretty unreliable in some situations

darwin17:01:05

here is the issue I have with breakpoints: https://github.com/binaryage/dirac/issues/64 is works only sometimes on simple code

darwin17:01:37

it would help if cljs generated dev code on more lines (use more newlines to split logical js pieces like humans)

thheller17:01:41

by now I've seen enough generated JS to know what the CLJS looked like 😛

darwin17:01:52

I see, that is what I tend to do as well, but I have to see the js files in devtools 🙂

darwin17:01:36

@thheller good news, your guess was correct changing sourceURL to full url fixed the issue in :eval mode for me

darwin17:01:08

sorry, I didn’t understand it at first because whenever I saw sourceURL I thought I’m reading sourceMappingURL, so I didn’t get it

darwin17:01:26

have to go, will updat the ticket later

darwin17:01:32

should be an easy fix, I hope