Fork me on GitHub
#shadow-cljs
<
2020-11-04
>
fabrao00:11:36

Hello all, I´m sorry about my dumb question, but is there any way to see the source of clojurescript in browser source?

fabrao00:11:59

using shadow-cljs?

fabrao02:11:10

or how to use shadow-cljs with external http server?

Elso09:11:54

I don't really understand the question. You want an arbitrary server to serve the JS that is compiled by shadow? It should be enough to include the JS in some page then and serve that while running the shadow watch-job. That is not different than using shadow with a Ring webserver and I guess you'll find some tutorials on how to set that combination up.

fabrao09:11:24

Hello, I thougth that would be a problem with showing .cljs source in browser

fabrao09:11:59

I´ve read that .cljs source in browser is a shadow-cljs limitation

Elso08:11:34

2020-11-04 09:21:57,377 [XNIO-1 I/O-1] DEBUG io.undertow.websockets.core.request - UT025003: Decoding WebSocket Frame with opCode 1 How do I turn this off on the shadow-cljs server log? my SLF4J config has an entry <logger name="org.xnio.nio" level="warn" /> but it doesn't seem like shadow reads that.

thheller09:11:22

@d.eltzner012 the logger org.xnio.nio doesn't affect io.undertow so you need to add that too. its your logging setup so you need to configure it.

Elso16:11:20

woops sorry, I'm blind. actually was not "my logging setup" in that someone else set it up and I didn't find the time to deal with it yet. sorry to bother with that

thheller09:11:09

@fabrao I do not understand the questions. you can use any webserver you want. just serve the generated .js files like any other static file.

fabrao10:11:31

@thheller Sorry, I thougth that custom server would be a problem about not showing `.cljs` source in browser. Now I know that is a shadow-cljs limitation

thheller10:11:05

I do not know what you mean by "showing .cljs source in browser"

fabrao10:11:19

source map, that you can see the clojurescript source in browser

thheller10:11:32

that works completely fine with shadow-cljs

fabrao10:11:54

:thinking_face:

thheller10:11:59

the only thing you have to watch out for is setting the correct :asset-path in your build config

fabrao10:11:31

:output-dir "resources/public/js"
                :asset-path "/js"

thheller10:11:52

assuming you load your JS via <script src="/js/main.js"> that is correct yes

fabrao10:11:46

yes <script src="/js/main.js" type="text/javascript"></script>

thheller10:11:08

ok looks fine

thheller10:11:59

do you get warnings/errors when loading the page about missing source maps? otherwise it should just work (assuming you are talking about watch or compile builds)

thheller10:11:06

release does not have source maps enabled by default

fabrao10:11:12

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

thheller10:11:59

source maps have worked forever so shadow-cljs version doesn't matter much. this is fine.

fabrao10:11:05

is there any pre-version for this/

thheller10:11:31

would help if you described what you expect to work and doesn't work as expected

fabrao10:11:08

if I got any error, it shows up into .cljs not in .js

thheller10:11:34

assuming that error actually occured in CLJS that should work fine

fabrao10:11:35

it only show by .js

fabrao10:11:14

If I go to sources from browser, do I have to see the .cljs over there?

thheller10:11:15

but you said something about external webserver? did you make sure that server does serve source maps correctly?

thheller10:11:31

yes CLJS sources should be listed

thheller10:11:05

/js/cljs-runtime/cljs/core.cljs for example

fabrao10:11:19

it´s pedestal from lacinia graphql, and I included the part about serving other stuffs

thheller10:11:46

well just open the webpage in chrome or whatever with the devtools open

thheller10:11:53

it should complain if it fails to load source maps

thheller10:11:38

you can also just try loading (or whatever port you are on) to see if its served correctly

thheller10:11:56

yeah looks like source maps are missing

fabrao10:11:56

yes, in that url took a map to download

thheller10:11:35

it should be served with application/json mime type

thheller10:11:52

maybe you need to configure that in your webserver

fabrao10:11:54

I tried with other samples, and it happens the same problem

thheller10:11:05

but the browser should be giving you a warning about this too

fabrao10:11:14

I tried in Edge and it works :thinking_face::thinking_face:

thheller10:11:47

yeah no clue. looks fine.

fabrao10:11:59

in Chrome it´s not working

fabrao10:11:33

lol, I got 2 days trying to figure it out

thheller10:11:46

maybe you have a bad service worker running or so? some bad cache?

thheller10:11:55

or maybe some browser extension messing with things?

fabrao10:11:23

I can bet it would be McAfee AV

fabrao10:11:43

man, that´s insane

fabrao10:11:58

Firefox is ok too, the only problem is that with McAfee WebAdvisor

thheller10:11:52

no clue. never used that.

fabrao10:11:23

thank you for your time !!!

Rico Meinl18:11:39

Is there any way to disable the hot reloading for target :chrome-extension? I tried :devtools {:autoload false} and it didnt work

thheller19:11:39

might be a bug if that doesn't disable it. why do you want to disable it?

Rico Meinl19:11:26

Cause it messes up the reloading of my chrome extension. If I use compile after every code change it works, but the watch inserts multiple instances of the content script

Rico Meinl19:11:52

Could you make it a variable?

thheller19:11:13

why does it insert multiple instances? its your code doing that no?

Rico Meinl19:11:06

Yeah it is. I'm trying to set it up in a way that I don't have to reload the web page for every code change. If it works with the auto load to false I'm happy to share the setup. It would make the chrome extension development 10x faster

thheller19:11:01

should be fixed in 2.11.7

Rico Meinl09:11:36

Thanks a million. Seems to work now