Fork me on GitHub
Robert Schulte08:03:42

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 :<dev-http-port>/some/path/within/<:asset-path>/cljs-runtime/<cljs-ns> Unexpected token < 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 ...


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

🙌 3
Robert Schulte09:03:26

Thank you so much @U05224H0W! 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:

👍 3

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


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) ( (<init> (<init> ( (cache.clj:24) (cache.clj:24) (closure.clj:2139)
	clojure.lang.PersistentVector.reduce (
	clojure.core/reduce (core.clj:6827)
	clojure.core/reduce (core.clj:6810)


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


Hi! I’m using Ubuntu 20.10


seems like the maximum filename length is 255 bytes for ext4


which this ridiculous packages manages to use up


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


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