This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-22
Channels
- # announcements (2)
- # babashka (64)
- # beginners (41)
- # calva (4)
- # cider (1)
- # clj-kondo (78)
- # cljdoc (31)
- # cljsrn (4)
- # clojars (2)
- # clojure (109)
- # clojure-germany (1)
- # clojure-italy (8)
- # clojure-nl (2)
- # clojure-spec (8)
- # clojure-uk (28)
- # clojurescript (61)
- # code-reviews (2)
- # cryogen (2)
- # cursive (23)
- # datomic (21)
- # duct (15)
- # fulcro (37)
- # graalvm (17)
- # graphql (3)
- # jackdaw (3)
- # joker (11)
- # lein-figwheel (4)
- # malli (42)
- # off-topic (97)
- # pathom (4)
- # pedestal (1)
- # portkey (3)
- # re-frame (7)
- # reagent (13)
- # reitit (2)
- # shadow-cljs (54)
- # spacemacs (1)
anyone using :npm-module
please let me know what you use it for so I can better decide what to do about it. currently a good chunk of the open shadow-cljs issues are about problems with :npm-module
and it is becoming harder to maintain with each new closure compiler release. https://github.com/thheller/shadow-cljs/issues/605
Oh, my! We rely heavily on it, converting an existing JS webpack project into a CLJS one, piece by piece!
yes but do you actually require separate namespaces? I mean from the JS code do you actually var x = require("wherever/one.ns.from-your-app")
for more than 1 namespace?
we have a utility library that among other things we use to construct schema definitions for our domain and then share those definitions across all our codebases. this includes our frontend which is written in plain javascript. we bundle up this utility library using shadow-cljs with :npm-module and then we include it in our ui app the same as any other dependency
mostly the schema definitions are responsible for taking a big json blob off the wire and coercing it into something useable in clojure/js as well as proving a useful error if it doesn't conform to the model we expect
hopefully that helps
but you are not using any of the :npm-module specific things? like require("./some-folder/one.simple.namespace")
and require("./some-folder/another.namespace")
?
well its spread across multitple files
so
import * as userSchema from 'utilityboss/public/utilityboss.schema.users';
and another namespace for other collections of related things
I'm trying to use Google's OAuth api. I installed the npm library using npm install googleapis
and I am trying to require it in my .cljs
file. This is my ns form:
(ns app.core
(:require [re-frame.core :as rf]
[reagent.core :as reagent]
["googleapis" :refer [google]]))
The browser outputs the following error:
Did I forget to do something? I tried scraping the Internet for more clues but I could not find anything
@lvbarbosa are you sure those are supposed to work in the browser? quick glance at the docs suggests they are meant for node?
yeah that definitely isn't made for the browser. looks like you are supposed to use this for the browser https://developers.google.com/docs/api/quickstart/js
Sorry for the late response! my bad, I'll take a look on the one you referenced! Thanks a lot
when building my app via shadow cljs watch app
i get the following logs:
[:app] Build failure:
Module Entry "some.namespace.module.main was moved out of module ":module".
It was moved to ":main" and used by #{:module :main}.
I'm not sure what the logs are telling me. I understand there is a build failure. But is it saying the module move (i am trying to do code splitting) is the issue?right
yeah, what it's saying is: there's a dependency inside your :main
module on the :module
entry point
the error just tells you that you did code splitting wrong as your ns require setup caused all code to me moved to one module and not where you intended things to go
Each ns becomes a module right?
Thanks. So if my goal is to split the code up, ill have to make sure everything is lazyly imported. Is there a way to know the dependency tree so that i can systematically prune out deps?
e.g main -> foo -> bar main -> bar I can see main points to bar directly in the main ns, but how would i track down main -> foo -> bar. I assume this is the problem im having.
when you open the shadow-cljs ui and run the build through that (default at http://localhost:9630) there is a basic interface to show dependencies
select the namespace and it'll show you everything that was responsible for including it
thanks again 🙂
Assuming everything builds correctly. What would the error: Unknown module: <module name>
imply?
Hi, I'm reading through the docs and am trying to do some in browser testing. The docs mention that it contains a built in test runner but I cannot seem to trigger it?
I added the configuration in the docs and got the server up and running. I don't know how to get the tests to run in-browser is the thing
:builds {:test {:target :browser-test
:test-dir "target/test"
:ns-regexp "-test$"
:devtools {:http-port 8021
:http-root "target/test"}}
I got that far but there was no console output or any evidence of something happening
the result should look something like this https://github.com/bhauman/cljs-test-display