Fork me on GitHub
#cljs-dev
<
2017-11-12
>
dnolen15:11:42

@plexus renaming happens in Closure so that usually means something has gone wrong so that Closure doesn’t know about the module for some reason

OliverM18:11:44

Hey, got pointed here from #clojurescript: Does anyone know how to require an rpm namespace with an @-symbol in its name? I've the following entry in my :npm-deps compiler entry: "@aeaton/react-prosemirror" "^0.9.7" (It's a string rather than a keyword as keywords can't contain @-symbols) That does add the right dependency to package.json, but then the following require fails: ["@aeaton/react-prosemirror" :refer [Editor MenuBar]] with the compiler error: No such namespace: @aeaton/react-prosemirror, could not locate _CIRCA_aeaton_SLASH_react_prosemirror.cljs, _CIRCA_aeaton_SLASH_react_prosemirror.cljc, or JavaScript source providing "@aeaton/react-prosemirror"

OliverM19:11:38

From reading the :verbose output of cljsbuild, the "@aeaton/react-prosemirror" is never downloaded as part of the node.js dependencies installation phase (the others are all listed)

OliverM19:11:10

So working around the @ symbol by including it as a string in the :npm-deps map only works because it gets skipped? (though the spec for that map does say keywords, strings or symbols are valid)

richiardiandrea19:11:41

Just as a side note, I PR-ed npm deps reading with scope in lumo - it might be not supported in ClojureScript currently as well

p-himik19:11:15

@oliver.mooney I think that packages that are never required may not be downloaded. When I require "@aeaton/react-prosemirror/dist", the package resides in node_modules and is compiled, but later there's another error regarding this string not being a symbol.

OliverM19:11:23

Ah, thanks @richiardiandrea looks like the cljs compiler had it fixed here?

richiardiandrea19:11:07

Oh yep it looks like it is there after all

OliverM19:11:51

@p-himik yeah, I do have a require statement in a namespace, as ["@aeaton/react-prosemirror" :refer [Editor MenuBar]] (one entry in a larger list)

richiardiandrea19:11:42

Just for curiosity, does a js/require work?

OliverM19:11:08

@richiardiandrea actually js/require is unrecognised at the repl, hmm

OliverM19:11:48

@p-himik oh I see what you're saying - if the require entry is wrong it'll also result in the package not being copied across in the compiler's :verbose output

OliverM19:11:37

so it's not an npm-deps issue (since the package is in the node_modules dir, it's the require statement at fault

anmonteiro19:11:46

@oliver.mooney if I had to guess I’d say you’re hitting this issue: https://github.com/google/closure-compiler/issues/2586

OliverM20:11:18

@anmonteiro is that just for UMD wrappers? react-prosemirror is es6

OliverM20:11:01

ah, you're right @anmonteiro thanks

OliverM20:11:39

still it saves me chasing it any further I guess

thosmos21:11:02

I'm attempting to use :npm-deps to use a browser JS library nivo and it looks like the following type of call is not getting processed: export * from './components/charts/bar' Is this a case of also needing babel preprocessing? If the JS library uses JSX and es6 do I need to also do a custom :foreign-libs entry with a reference to the cljsjs-babel-standalone? How does this work with :npm-deps? Any example of this I can look at?