Hello all, I´m sorry about my dumb question, but is there any way to see the source of clojurescript in browser source?
using shadow-cljs?
or how to use shadow-cljs
with external http server?
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.
Hello, I thougth that would be a problem with showing .cljs
source in browser
I´ve read that .cljs
source in browser is a shadow-cljs limitation
Eh yeah I think my answer was actually nonsense too - https://stackoverflow.com/questions/60543802/get-sourcemapped-source-place-in-browser
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.
@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.
@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.
@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
I do not know what you mean by "showing .cljs source in browser"
source map, that you can see the clojurescript source in browser
that works completely fine with shadow-cljs
:thinking_face:
the only thing you have to watch out for is setting the correct :asset-path
in your build config
:output-dir "resources/public/js"
:asset-path "/js"
assuming you load your JS via <script src="/js/main.js">
that is correct yes
yes <script src="/js/main.js" type="text/javascript"></script>
ok looks fine
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)
release
does not have source maps enabled by default
thheller/shadow-cljs {:mvn/version "2.11.2"}
source maps have worked forever so shadow-cljs version doesn't matter much. this is fine.
is there any pre-version for this/
?
would help if you described what you expect to work and doesn't work as expected
if I got any error, it shows up into .cljs not in .js
assuming that error actually occured in CLJS that should work fine
it only show by .js
If I go to sources from browser, do I have to see the .cljs over there?
but you said something about external webserver? did you make sure that server does serve source maps correctly?
yes CLJS sources should be listed
/js/cljs-runtime/cljs/core.cljs
for example
it´s pedestal from lacinia graphql, and I included the part about serving other stuffs
well just open the webpage in chrome or whatever with the devtools open
it should complain if it fails to load source maps
you can also just try loading <http://localhost:8080/js/cljs-runtime/cljs.core.js.map>
(or whatever port you are on) to see if its served correctly
yeah looks like source maps are missing
yes, in that url took a map to download
it should be served with application/json
mime type
maybe you need to configure that in your webserver
I tried with other samples, and it happens the same problem
but the browser should be giving you a warning about this too
I tried in Edge and it works :thinking_face::thinking_face:
yeah no clue. looks fine.
in Chrome it´s not working
WTF?
lol, I got 2 days trying to figure it out
maybe you have a bad service worker running or so? some bad cache?
or maybe some browser extension messing with things?
I can bet it would be McAfee AV
man, that´s insane
Firefox is ok too, the only problem is that with McAfee WebAdvisor
no clue. never used that.
thank you for your time !!!
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
Is there any way to disable the hot reloading for target :chrome-extension? I tried :devtools {:autoload false}
and it didnt work
might be a bug if that doesn't disable it. why do you want to disable it?
yeah looks like its hardcoded to be enabled https://github.com/thheller/shadow-cljs/blob/ad8ea9d4aefc5d1c0ab371613a9c96c17da3d447/src/main/shadow/build/targets/chrome_extension.clj#L84
Thanks a million. Seems to work now
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
Could you make it a variable?
sure
why does it insert multiple instances? its your code doing that no?
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
should be fixed in 2.11.7