shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
thheller 2021-03-17T08:29:51.024500Z

watch or compile produce the cljs-runtime dir. release does not and does not need it. it also doesn't clear it though. you can just rm -rf the-output-dir && shadow-cljs release app or so yourself

Robert Schulte 2021-03-17T08:37:42.028200Z

I have some trouble regarding source maps in combination with client-side routing in my development build: • When I access my SPA via localhost:<dev-http-port>, everything works as expected. • When I enter via localhost:<dev-http-port>/some/path/within/spa, the browser console is flooded with warnings regarding unresolvable source maps. In Chrome these warnings look like this:

DevTools failed to load SourceMap: Could not parse content for <http://localhost>:&lt;dev-http-port&gt;/some/path/within/&lt;:asset-path&gt;/cljs-runtime/&lt;cljs-ns&gt;.js.map: Unexpected token &lt; in JSON at position 0
I have looked into the generated code and reviewed the source maps v3 specification; shadow-cljs writes relative sourceMappingUrl (and sourceURL). According to the spec the browser should resolve sourceMappingURL relative to the "page's origin" for evaled code. As it stands, the only chance I have to make this work is to pass a custom :dev-http :handler that strips /some/path/within from the URL before handing it to the default :handler, correct? Would it make sense to provide an option to have shadow-cljs create absolute URLs for sourceMappingUrl and sourceURL? This would probably only make sense with a single port :dev-http ...

thheller 2021-03-17T09:32:01.029300Z

@rlschulte21 use an absolute :asset-path. so "/js" instead of "js" or whereever you have your files

1🙌
thheller 2021-03-17T09:33:58.030100Z

no it doesn't make sense to configure this in :dev-http. :asset-path is the config option that controls this.

Robert Schulte 2021-03-17T09:44:26.030300Z

Thank you so much @thheller! Prepending :asset-path with / has lead to the creation of absolute // # sourceURL and everything works as expected now. Thank you for debugging my configuration without me even sharing it.. Thank you for your quick response and your great work on shadow-cljs:raised_hands:

1👍
laurent 2021-03-17T17:03:25.038500Z

Hi all! I'm trying to set up a cljs project but when I try to add chakra-ui I get a compile error. I tried to figure it out for about an hour but I did not get very far as I'm a newbie. I would appreciate it if a good soul would send me in the right direction. Thanks! (i added @emotion/react but that did not help)

FileNotFoundException: .shadow-cljs/builds/app/dev/shadow-js/module$node_modules$$emotion$react$isolated_hoist_non_react_statics_do_not_use_this_in_your_code$dist$emotion_react_isolated_hoist_non_react_statics_do_not_use_this_in_your_code_browser_cjs.js (File name too long)
	java.io.FileOutputStream.open0 (FileOutputStream.java:-2)
	java.io.FileOutputStream.open (FileOutputStream.java:298)
	java.io.FileOutputStream.&lt;init&gt; (FileOutputStream.java:237)
	java.io.FileOutputStream.&lt;init&gt; (FileOutputStream.java:187)
	shadow.build.cache/write-file (cache.clj:24)
	shadow.build.cache/write-file (cache.clj:24)
	shadow.build.closure/convert-sources-simple/fn--12171/fn--12173 (closure.clj:2139)
	clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
	clojure.core/reduce (core.clj:6827)
	clojure.core/reduce (core.clj:6810)
    ....

thheller 2021-03-17T20:45:17.039300Z

@laurent wow that is indeed a long filename. what OS are you on?

thheller 2021-03-18T09:25:59.044200Z

hmm doh

thheller 2021-03-18T09:26:15.044400Z

seems like the maximum filename length is 255 bytes for ext4

thheller 2021-03-18T09:26:36.044600Z

which this ridiculous packages manages to use up

thheller 2021-03-18T09:26:55.044800Z

unfortunately I don't have an easy fix for you. this is the first time I see such a long name

laurent 2021-03-18T12:37:54.067700Z

Thanks @thheller! I search replaced the file name with a shorter name across the project and it works.