You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nil values when building clojurescript for chrome extension #432
Hello, I'm having some difficulty with using datascript in my chrome extension.
I'm building from clojurescript with shadow-cljs, using build settings :target :node-library
and then importing the bundle in my chrome extension.
Besides some funkiness with the imports, everything has worked as expected, and I've been
able to execute the bundled Clojure code from my chrome extension. I know that datascript
has a javascript API, but I'm currently testing out this project setup to see if the added
convenience of having a clojure REPL and developing the datascript queries/logic in clojurescript is worth it.
The problem I'm having, is that my datascript query works perfectly fine when
executed from a Clojure REPL, but when I run the code from the chrome extension
the results of the query are, as far as I can tell, replaced with nil values.
I think this isn't a datascript problem, and this is related somehow to the specifics
of compiling and running my Clojure code in a chrome extension. However, since
datascript has a javascript API* that has the expected behavior, I hope
there might be some insights into my problem. Thank you!
*I set up this same project using the javascript API and it works as expected.
Here is my javascript code for reference: Popup.svelte
Activity
tonsky commentedon May 19, 2022
Try adding
:externs ["datascript/externs.js"]to:compiler-optionsmap inshadow-cljs.edn? #298 #216macklinhrw commentedon May 19, 2022
This worked! Thanks, and of course, 1 line of code fixes my 6 hours of headache.
Here is the new config file for anybody interested:
Mention externs for shadow-cljs users #432
tonsky commentedon May 20, 2022
Great! Added to README too