Fork me on GitHub
Ivan Fedorov09:06:21

getting a StringIndexOutOfBoundsException when trying to load a file to a repl. • Tried relaunching the server, updated to 2.23.3, didn’t help. • Project compilation on itself – works, so this happens only when loading into a repl • deleting different file parts helps, but this seems quite random.


odd. do you maybe have an accidental special unicode char in there?

Ivan Fedorov09:06:24

seems like it’s failing when encounters lines with a ; right after closing parens

Ivan Fedorov09:06:52

The ns is special too, has some regexes and loads macros. But the ; seems to be the main contributor


that is very odd indeed


but could still be some kind of invisible char there? did you check?


like that I guess?


sometimes unicode can be tricky

Ivan Fedorov21:06:07

I checked with vim via :set list it showed ;$ where this dollar sign is semi-transparent and indicates end of string

Ivan Fedorov21:06:16

I experimented a bit and found a minimal reproduction case. Just put this into your cljs file and eval the whole ns into a repl

(def ua-regexp (js/RegExp. "(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\\/)([\\d\\.apre]+)"))
(def -ua-info (.exec ua-regexp js/navigator.userAgent));
(def ddd (or ua-regexp -ua-info));

Ivan Fedorov21:06:21

if you switch off the last line – it will work. with the line it breaks. until you erase the ; cc @U05224H0W

Ivan Fedorov21:06:27

I can file a ticket for you. since I can live without these semicolons – this has no impact on me.


this isn't a shadow-cljs issue. it is a tools.reader issue


I reduced it further to

(def foo "foo");
(def bar [])


repro with just tools.reader

(let [rdr (
            "(ns demo.test)\n\n(def foo \"foo\");\n(def bar [])\n")]
  ( rdr)
  ( rdr)
  ( rdr))


shadow-cljs uses read+string in a loop there, but the gist is reading the 3 forms in sequence


somehow it gets into a confused state after the second I guess, no clue what is going on though


regular compilation does not use read+string, so thats why that works.

Ivan Fedorov11:06:36

Ah, so I should pass it to tools reader project. Filed


they don't do github issues. gotta go through or jira


also ran into this. couldn't find anything on, was there a followup?

Rachel Westmacott16:06:29

Has anyone here used Material Design Icons in a clojurescript project?

Rachel Westmacott16:06:42

(I'm having a little trouble making it work)


whats the problem?

Rachel Westmacott16:06:39

We tried to pull in with an npm install and got it in our /node_modules but we didn't get the CSS we wanted in our target directory


shadow-cljs doesn't build any css, so that in itself won't do anything


what are you using to build your css?

Rachel Westmacott16:06:49

So if we pull in an NPM module with CSS resources then we need to manually (programatically) ensure we copy those into our target directory?


well you need to build your css in some way


just copying might be fine. or tools such as postcss can be useful

Rachel Westmacott16:06:38

thank you - you've increased my understanding

Rachel Westmacott16:06:36

I guess I'm surprised to discover that js is being pulled in, but css isn't

Rachel Westmacott16:06:00

but I'm no expert on this

Rachel Westmacott16:06:06

(it may be our project setup doing something funky!)


too many ways to handle css and non-trivial to support. I don't have the time to add that support to shadow-cljs, and frankly I don't think it should. better served by tools specifically designed for css.

gratitude 2

you can always use webpack of course, that handles css as well