KEMBAR78
fix externs.js and the exported symbols by thheller · Pull Request #216 · tonsky/datascript · GitHub
Skip to content

Conversation

@thheller
Copy link
Contributor

The datascript/externs.js is written incorrectly.

Including the externs via deps.cljs means that CLJS projects can never rename them as well which isn't useful. CLJS projects that want to use this would be better off without the externs/exports.

You should consider only using the externs/exports when building the JS lib.

@tonsky
Copy link
Owner

tonsky commented Apr 11, 2017

Sure, but DataScript implementation depends on datom fields not being renamed. I have to include those. As for entity, what I was doing is aimed for JS only, that’s right.

@zarkone
Copy link

zarkone commented May 19, 2018

Not sure if that related but I also had problems with datascript, compiling with shadow-cljs.

For example, this code works without optimizations, but doesn't work with :advanced enabled, i.e. in :realease mode:

(d/q '[:find [?atom ...] :in $ ?url
                         :where [?e :url ?url]
                                [?e :atom ?atom]]
                   @db url)

I've solved it without patching anything by adding contents of datascript/externs.js to my manual-externs.js file I already had for externs:

Related part of shadow-cljs.edn:

:release {:compiler-options {:externs ["manual-externs.js"]
                             :optimizations :advanced}}

@tonsky
Copy link
Owner

tonsky commented Nov 29, 2018

@zarkone are you sure it’s datascript problem? maybe your build just doesn’t know how to lookup externs served with libraries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants