Uncaught TypeError: Cannot read properties of undefined

I have developed a small webapp based on re-frame and powered by shadow-cljs. It is working fine in dev mode (shadow-cljs watch app) with no error, no warning (except React complaining about ReactDOM.render not being supported anymore in React 18).

Then I build the release of the app (shadow-cljs release app) and in total confidence, access to the home page of my small webapp … but then boum ! blank page and this exception in the console :


Of course looking at the minified JS code in main.js didn’t help …

Has anyone ever exeprienced such behavior ? what would be your advice to investigate on this case ? How could I collect more info about what is happening that could cause thie exception ?
Thanks for your help

Most likely, something got minified when it wasn’t supposed to. E.g. if you have (.-foo bar) the compiler might decide that foo should be renamed. Usually in such cases the compiler is either quite certain about that or warns about not being able to infer the type of the target in the expression - in the latter case, you probably need to use (.-foo ^js bar).

In any case, the first step would be to create a release build with pseudo names - you can do that by adding --debug to the shadow-cljs release build command.

1 Like

thanks @p-himik for your fast reply, I will follow your advice and keep on digging :wink:

Thanks to your help I could find the error ! Adding --debug allowed me to see the cljs code that was causing the error (something related to goog.events.KeyCodes).
Now it works fine !!


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.