Closed djblue closed 2 years ago
@djblue Yes, an explicit get
would be good, PR welcome. I'm curious how you are going to use this: are you going to convert the React module to a Clojure map and put it into the namespaces config?
Yup, I'm doing something like:
(defn- import-npm [m]
(reduce-kv
(fn [m k v]
(assoc m (symbol k) v))
{}
(js->clj m)))
(def namespaces
(merge
{"react" (import-npm react)}
...))
For exposing npm deps to portal sci extensions.
@djblue ok, that's cool. Are you including react before-hand or dynamically while portal is running?
If you need to do anything async in the future (ES modules are going to force us to do that probably) then I recommend taking a look at what nbb is doing. I can tell you more about this, if you end up needing that some time.
@djblue Btw, I think it would be good to have at least one test for this to prevent future regressions.
Is your feature request related to a problem? Please describe.
When using ClojureScript, it is common to use the following syntax:
This denotes a javascript dependency, usually from npm.
Describe the solution you'd like
By using an explicit
get
here, it would allow npm dependencies to participate in the name resolution algorithm.Describe alternatives you've considered
None so far.
Also, I'd be more than happy to put up a PR if you think this is a good idea.