This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-03
Channels
- # adventofcode (49)
- # bangalore-clj (1)
- # beginners (56)
- # berlin (1)
- # chestnut (6)
- # cljs-dev (5)
- # clojure (48)
- # clojure-greece (29)
- # clojure-russia (3)
- # clojure-spec (5)
- # clojure-uk (3)
- # clojurescript (28)
- # cursive (25)
- # emacs (3)
- # fulcro (123)
- # hoplon (2)
- # klipse (6)
- # off-topic (146)
- # om (11)
- # re-frame (29)
- # reagent (7)
- # reitit (3)
- # specter (11)
- # unrepl (4)
- # yada (3)
1- Is possible use javascript-modules
with export default
?
2- Should I import js.foo
or js.foo.index
in case of src/js/foo/index.js
with "export default"?
3- When I run the example from https://clojurescript.org/guides/javascript-modules , on the repl says
WARNING: JavaScript file found on classpath for library js.hello
, but does not contain a corresponding goog.provide
declaration: file:/home/souenzzo/top-secret-project/src/js/hello.js
It's excepteced?
Hi, I am trying to use reader literals with the latest figwheel, Template. The data_readers.clj file contains
{dbz/l debuz.utils/cmlog}
but when I (:require [debuz.utils])
in the name space decleration I get ^--- Attempting to call unbound fn: #'debuz.utils/cmlog i
implying that the cmlog function is not binded. What am i doing wrong ?Good day channel! I'm trying to get into clojurescript and reagent, but stuck with Uncaught ReferenceError: react_dom is not defined
. Non-reagent clojurescript works fine. All of it regardless if figwheel is turned on or off. So what can I read to understand the cause?
@ognivo Try using a stable release of reagent instead of an alpha. I believe the alpha requires some npm-deps im the compiler options: https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules
ok, now its base.js:639 goog.require could not find: create_react_class
I even see ReactDOM in globals
On alpha2
What's in your :npm-deps
? Are you able to share your complete project on github or something?
sure thing, sir https://github.com/spacegangster/sg-share
I don't see a project.clj
file(?)
oh well, fixed now
for a reason I don't know yet similar configuration lein new reagent
produces single module, whilst mine inferred from lein new chestnut
produces a set of modules. With :optimizations :advanced
it becomes a single module, but the error seems to persist, just with mangled names.
fixed? are you still getting "could not find: create_react_class", I think you might need to npm install [email protected]
Fixed on 0.8.0-alpha2. So the fixed error is `Uncaught TypeError: Cannot read property 'render' of undefined
at reagent$dom$render_comp (calendrie.js:63913)`.
Fixed by deleting node_modules
dir. Jee, that was a bit obscure that compilation depends on it at all.
@hee-foo Not sure, but I think you need to quote it: {dbz/l #'debuz.utils/cmlog}
. A fuller example would help give me more context to your problem.
@au-phiware Quoting doesnt work. Here is the full debuz.utils
( ns debuz.utils
(:require
[clojure.string :as str]
[goog.dom :as dom]
[goog.dom.dataset :as domdata]))
(defn- cmessage [f]
(fn [& args]
(if js/goog.DEBUG (f args) nil)))
(def cmlog (cmessage js/console.log))
then in core.cljs :
(ns debuz.core
(:require [debuz.utils]))
(enable-console-print!)
#dbz/l "This text is printed from src/debuz/core.cljs. Go ahead and edit it and see reloading in action."
project.clj
:dependencies [[org.clojure/clojure "1.9.0-beta4"]
[org.clojure/clojurescript "1.9.946"]
[org.clojure/core.async "0.3.443"]]
@souenzzo 1. Yes, there should be a default property after you've required it. 2. I've found this a tricky question my self, require it with whatever you would in es6, note you can pass strings to require now. 3. Yes, depending on how you've setup your project you will get this messages.
@hee-foo save yourself the trouble with data readers and just call (dbz/l ...)
directly instead
@souenzzo 2. I might of mislead you (I was thinking of something else), it should depend on what you have in your foreign-libs
entry.
I'm trying to use https://clojurescript.org/guides/javascript-modules + ES6 modules. I dont need foreign-libs, right?
From the page you linked: "Notice that a :foreign-libs entry may now specify a directory for :file. In this case, the ClojureScript compiler will recursively search this directory for .js files and automatically create the :foreign-libs entries for you with the supplied options. The :provides namespace for each entry will be automatically computed from the directory structure." :)
You might be thinking of npm/node modules