This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-26
Channels
- # aws (1)
- # aws-lambda (16)
- # beginners (8)
- # boot (2)
- # cider (4)
- # cljsrn (9)
- # clojure (137)
- # clojure-italy (3)
- # clojure-russia (39)
- # clojure-spec (34)
- # clojure-uk (33)
- # clojurescript (44)
- # core-logic (11)
- # cursive (27)
- # data-science (16)
- # datomic (52)
- # duct (1)
- # emacs (1)
- # figwheel (2)
- # fulcro (90)
- # graphql (3)
- # hoplon (7)
- # lambdaisland (2)
- # leiningen (23)
- # lumo (1)
- # off-topic (1)
- # om (40)
- # onyx (44)
- # re-frame (116)
- # reagent (3)
- # shadow-cljs (87)
Nice re-frame example you've built @mhuebert (+ @thheller of course)
@richiardiandrea thanks! just pushed an update with some better explanations + a newer version of re-frame-trace https://mhuebert.github.io/shadow-re-frame/
but yeah .. source maps for âforeign libsâ .. yay, that didnât work before đ
oh, found a simple bug in bootstrap loader: https://dev.maria.cloud/gist/34d3fde5e062fe9ac9027386af588568?eval=true was going to make a PR but got tied up this afternoon
i think it just needs to check of a namespace already exists in compiler state before looking in the index
in lumo:
cljs.user=> (ns )
nil
=> (contains? @cljs.js/*loaded* ')
false
=> (contains? (set (keys (:cljs.analyzer/namespaces @cljs.env/*compiler*))) ')
true
=> (require ')
No such namespace: , could not locate the_thing/me.cljs, the_thing/me.cljc, or Closure namespace ""
have i gone mad. i totally thought this should work: (planck now)
cljs.user=> (ns a.core)
nil
a.core=> (ns b.core (:require [a.core]))
No such namespace: a.core, could not locate a/core.cljs, a/core.cljc, or Closure namespace "a.core"
lumo again:
cljs.user=> (ns a.core)
nil
a.core=> (def x 10)
#'a.core/x
a.core=> (ns b.core)
nil
b.core=> a.core/x
10
b.core=> (require '[a.core :as a])
No such namespace: a.core, could not locate a/core.cljs, a/core.cljc, or Closure namespace "a.core"
shadow-cljs node-repl
shadow-cljs - config: /Users/zilence/code/shadow-cljs/shadow-cljs.edn version: 2.0.42
shadow-cljs - connected to server
shadow-cljs - starting node-repl
[:node-repl] Configuring build.
[:node-repl] Compiling ...
[:node-repl] Build completed. (39 files, 19 compiled, 0 warnings, 11.63s)
[3:1]~cljs.user=> JS runtime connected.
[3:1]~cljs.user=> (ns a.core)
[3:1]~a.core=> (ns b.core (:require [a.core]))
[3:1]~b.core=>
@mhuebert I think this correctly mirrors clojure behaviour https://github.com/thheller/shadow-cljs/commit/492b4f0d1aa77746b97640715afaf276b81567cb
(ns reagent.core)
(def x 1)
(ns b.core (:require [reagent.core :as a]))
(js/console.log "x" a/x)
(require 'reagent.core :reload)
that should load reagent.core
from disk but does nothing (since there is analyzer data)
in cljs.js:
(defn require
([name cb]
(require name nil cb))
([name opts cb]
(require nil name opts cb))
([bound-vars name opts cb]
(require bound-vars name nil opts cb))
([bound-vars name reload opts cb]
(let [bound-vars (merge
{:*compiler* (env/default-compiler-env)
:*data-readers* tags/*cljs-data-readers*
:*load-macros* (:load-macros opts true)
:*analyze-deps* (:analyze-deps opts true)
:*load-fn* (or (:load opts) *load-fn*)
:*eval-fn* (or (:eval opts) *eval-fn*)}
bound-vars)
aname (cond-> name (:macros-ns opts) ana/macro-ns-name)]
(when (= :reload reload)
(swap! *loaded* disj aname))
(when (= :reload-all reload)
(reset! *loaded* #{}))
...
hmm, so⌠an error should be thrown if the ns is not in compiler-state nor the index; but if it is in the index, always load it, even if it exists in compiler state?
if we aggressively reloaded, then we could wipe out changes to an ns that had been made locally. i donât think a user ever expects a simple (require âthe.thing) to modify it if it exists.