Fork me on GitHub
#clojurescript
<
2019-02-09
>
kzeidler01:02:58

Howdy. I'm an ex-Lisper considering refactoring a javascript SPA into clojurescript but I'm having a heck of a time getting a working dev environment off the ground. Can anyone give me some insight into what's going on here?

kzeidler01:02:04

`kz@XPS-15-9570:~/dev/git/fertile$ lein new reagent wtf +cider Generating fresh 'lein new' Reagent project. kz@XPS-15-9570:~/dev/git/fertile$ cd wtf kz@XPS-15-9570:~/dev/git/fertile/wtf$ ls env Procfile README.md src LICENSE project.clj resources system.properties kz@XPS-15-9570:~/dev/git/fertile/wtf$ lein compile Warning: implicit middleware found: cider-nrepl.plugin/middleware Please declare all middleware in :middleware as implicit loading is deprecated. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by mranderson048.orchard.v0v3v0.dynapath.v0v2v5.dynapath.defaults$eval2158$fn__2159 to method java.net.URLClassLoader.addURL(java.net.URL) WARNING: Please consider reporting this to the maintainers of mranderson048.orchard.v0v3v0.dynapath.v0v2v5.dynapath.defaults$eval2158$fn__2159 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Warning: implicit middleware found: refactor-nrepl.plugin/middleware Please declare all middleware in :middleware as implicit loading is deprecated. Warning: implicit hook found: lein-environ.plugin/hooks Hooks are deprecated and will be removed in a future version.`

kzeidler02:02:34

I tried the reagent-tutorial instead but now I'm getting the following error on build... 😬

kzeidler02:02:40

Compiling "app.js" from ["src-cljs"]...
Compiling "app.js" failed.
java.lang.IllegalAccessException: class clojure.lang.Reflector cannot access class jdk.internal.loader.BuiltinClassLoader (in module java.base) because module java.base does not export jdk.internal.loader to unnamed module @3c07e830
           Reflection.java:360 jdk.internal.reflect.Reflection.newIllegalAccessException

john03:02:03

ran clean here

john03:02:10

I'm on mac though

Black11:02:19

Hey, I am little bit confused, I am using cljsbuild to deploy SPA and in my index.html where I am loading js there is path /js/compiled/app.js, but my question is does it client get updated js when I make deploy and he has app.js in cache? I always had to modify path into something like app.js?version=XXX but I did not found any resource where this issue were pointed out.

dpsutton19:02:55

how do you determine what namespace to import when consuming libraries from npm? For instance i'm (trying to) use oauthjs. so yarn install oauthjs and then crank up shadow. How do i determine the import statement from that?

lilactown19:02:29

it will be something like: ["npm-package-name" ...]

lilactown20:02:45

the tricky bit is that, depending on how the NPM module is packaged, you might use: ["npm-package-name" :as some-alias] OR ["npm-package-name" :default some-alias] :default is a shadow-cljs thing that helps with packages that only export a default object/function/etc.

dpsutton20:02:13

i was hoping i could stumble my way through it but i am chastised. I'll read those docs. thanks @lilactown

👍 5
lilactown20:02:10

based on the README for that NPM package, you’ll probably write:

;; docs say: `import {OAuth2, OAuth2Configuration, OAuth2GrantTypes} from 'oauthjs'`
(my-ns
 (:require ["oauthjs" :as oathjs]))

(oauthjs/Oauth2 ...)

lilactown20:02:53

but it can depend on how the package is actually provided, so you might have to futz a bit. if you get stuck, doing the above and logging what oauthjs looks like can help troubleshoot

dpsutton20:02:50

interesting. i did yarn install oauthjs and when i (require '["oauthjs" :as oauth]) I'm told by shadow that not all of its deps were installed > The required JS dependency "querystring" is not available, it was required by "node_modules/oauthjs/dist/oauth2.js".

dpsutton20:02:09

i'll start higher up in the docs 🙂

dpsutton20:02:15

thanks for your help

lilactown20:02:46

that is strange.

lilactown20:02:18

I honestly haven’t tried dynamic require of an npm package before so I wonder if there’s a bug

lilactown20:02:46

do you see querystring in your node_modules?

dpsutton20:02:43

I'll have to look when I get back home. Have to run an errand. Thanks for your help so far though

dpsutton21:02:16

interesting. querystring just seems to not be seen by shadow? My package.json file only specifies "querystring": "^0.2.0", npm install brings querystring into node_modules. and then

(ns beta.main
  (:require ["querystring" :as qs]))
in the rpel
The required JS dependency "querystring" is not available, it was required by "beta/main.cljs".

Searched in:/home/dan/projects/clojure/beta/node_modules

lilactown21:02:40

try restarting your process?

lilactown21:02:45

otherwise I’d bring it up in #shadow-cljs

dpsutton21:02:23

i'll do that. thanks

michaelteter21:02:26

Hi All. Can anyone direct me to a current book or complete guide to mobile development with ClojureScript? 🙂

mfikes22:02:54

@michael401 Not aware of anything like that. I’d suggest the resources at http://cljsrn.org for a React Native-centric approach.

michaelteter22:02:56

@mfikes ok, thank you. I'll start there. I suspect everyone is too busy actually doing work to write books (and/or the landscape changes so quickly that it's not worth the effort to write a book that will be outdated when it goes to print).