Fork me on GitHub
#shadow-cljs
<
2019-02-09
>
thheller09:02:36

@currentoor at compile time no. at runtime you can check cljs.core/*target* (will be nodejs) for node targets

šŸ‘ 5
thheller09:02:09

you could in theory check that at compile time by checking the compiler env but thats not really recommended

thheller09:02:38

@jstaab you don't seem to be using :npm-module? a dev build generates many files and cannot be loaded by webpack unless you use :npm-module

thheller13:02:29

Would anyone be interested in a new feature that could reduce the startup time of shadow-cljs by about 50% but would require running a separate command that can take a minute or so to run whenever the classpath changes?

thheller13:02:01

I kinda decided that its not worth the effort but all the code is pretty much finished

thheller13:02:19

I don't restart shadow-cljs often enough so startup time doesn't matter much to me but others may feel different

thheller13:02:54

(this would be achieved by generating an AppCDS archive as described here https://mjg123.github.io/2017/10/04/AppCDS-and-Clojure.html)

thheller13:02:04

unfortunately this cannot be pre-generated or so and cannot be shared amount projects since the classpath must match

jstaab16:02:55

@thheller that would be a net gain for me, but might cause some friction for first time adopters if first-run was excessively slow. It would only serve to amplify startup time complaints I'd imagine. By the way, I do love the client-server architecture; that's so much the way to go. As for your suggestion above, I'll try npm-module. I had moved away from that to browser for some reason; I can't remember what problems I'd had.

dpsutton21:02:38

wondering if anyone might have some insight. My real goal is to use oauthjs but this has a dependency on querystring. So in a blank project, npm i querystring and then in an ns form (:require ["querystring" :as qs]) yields:

[:app] Build failure:
The required JS dependency "querystring" is not available, it was required by "beta/main.cljs".

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

You probably need to run:
  npm install querystring
but
[dan@fedora beta]$ tree -L 1 node_modules/
node_modules/
ā””ā”€ā”€ querystring

dpsutton21:02:15

(this is the symptom i observe when trying to consume oauthjs but a smallest reproduction)

jstaab21:02:57

I was able to follow those steps and had no trouble. How are you setting up shadow-cljs? The only thing I can think of is the js-provider options: https://shadow-cljs.github.io/docs/UsersGuide.html#js-provider

dpsutton21:02:18

{:source-paths ["src"]
 :dependencies []
 :builds       {:app {:output-dir "target/"
                      :asset-path "."
                      :target     :browser
                      :modules    {:main {:init-fn beta.main/main!}}
                      :devtools   {:after-load beta.main/reload!
                                   :http-root  "target"
                                   :http-port  8080}}}}
this is how i'm setting it up. have i missed something?

dpsutton21:02:39

[dan@fedora beta]$ which shadow-cljs
~/.nvm/versions/node/v11.9.0/bin/shadow-cljs

dpsutton21:02:56

shadow 2.7.30

jstaab21:02:04

Hmm same node and shadow on my end. What happens if you require from node? e.g. node -e 'console.log(require("querystring"))'

jstaab21:02:10

Though I'm not sure if that has anything to do with how shadow resolves dependencies

thheller21:02:57

@dpsutton do you have shadow-cljs installed in your project?

thheller21:02:55

IIRC querystring is one of those packages that needs a browser polyfill which gets installed when you install shadow-cljs in your project

thheller21:02:49

just npm install shadow-cljs in your project (never rely on the global install)

dpsutton23:02:31

I didn't have shadow-cljs installed. Doing that seems to have cleared everything right up.

dpsutton23:02:11

thanks for being so helpful and thorough with your documentation