This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-02
Channels
- # aleph (1)
- # announcements (1)
- # babashka (4)
- # beginners (89)
- # calva (3)
- # chlorine-clover (18)
- # cider (33)
- # clj-kondo (27)
- # cljdoc (4)
- # cljsrn (2)
- # clojure (248)
- # clojure-europe (7)
- # clojure-italy (15)
- # clojure-nl (7)
- # clojure-norway (10)
- # clojure-poland (1)
- # clojure-spec (12)
- # clojure-sweden (5)
- # clojure-uk (57)
- # clojured (4)
- # clojuredesign-podcast (1)
- # clojurescript (55)
- # core-async (14)
- # core-logic (3)
- # cursive (10)
- # datomic (38)
- # figwheel-main (8)
- # fulcro (23)
- # graalvm (126)
- # hoplon (59)
- # jobs (1)
- # kaocha (3)
- # malli (30)
- # meander (17)
- # off-topic (32)
- # pathom (19)
- # pedestal (4)
- # re-frame (12)
- # reagent (2)
- # reitit (3)
- # shadow-cljs (81)
- # sql (9)
- # tools-deps (34)
- # vim (20)
- # vscode (7)
- # xtdb (5)
Is it possible in shadow to depend on a library which bundles a js library and provides externs? specifically I'm trying to use https://github.com/cjohansen/dumdom . I have a shim file which looks like
(ns snabbdom
(:require ["snabbdom" :as snabbdom]))
(js/goog.exportSymbol "snabbdom" snabbdom)
But this line is triggering an error:
https://github.com/cjohansen/dumdom/blob/dd7cbae5e1b03892a068410e246cd44dcaeb8cbf/src/dumdom/core.cljs#L20
Failed to load dumdom/core.cljs TypeError: Cannot read property 'create' of null
at Object.exports.init (snabbdom.js:39)
at eval (core.cljs:23)
(All the properties of js/snabbdom used on that line are coming up nil)@jjttjj the issue is that the namespace can't be the same name as the exported symbol
can I also do es6 module imports over http like in the first example in https://github.com/observablehq/runtime#observablehqruntime?
in the case of http://observablehq.com, I’m not so sure.
so https://api.observablehq.com/@tmcw/hello-world.js?v=3 is https://observablehq.com/@tmcw/hello-world as a es6 module
not sure what you are trying to build but what would you statically want to include a notebook in a build?
you can always just curl
the notebook and include it in your build if you really want
right, I’m also not quite sure what I’m building here yet 😼 well thanks for shadow & your help!
FWIW adding support for an URL resolver wouldn't even be that hard but I'm not so sure it is a good idea
Hello. How to properly setup devcards
in shadow-cljs?
This does not seem to work
;; shadow-cljs configuration
{:source-paths
["src"
"test"
"tailwind.config.js"]
:dependencies
[[reagent "0.9.1"]
[metosin/reitit "0.4.2"]
[binaryage/devtools "1.0.0"]
[devcards "0.2.6"]]
:builds
{
:devcards {:target :browser
:output-dir "devcards"
:asset-path "/"
:compiler-options {:devcards true
:source-map-timestamp true}
:modules {:devcards {:entries [limeray.web.app-test]}}
:devtools {:http-port 9003
:http-root "devcards"}}}}
;; limeray.web.app-test
(ns limeray.web.app-test
(:require
[cljs.test :refer [testing is use-fixtures]]
[devcards.core :as dc]
[reagent.core :as r]
[limeray.web.components :as ui]
["@testing-library/react" :as rtl])
(:require-macros
[devcards.core :refer [defcard deftest]]))
(enable-console-print!)
(defcard my-first-card
(r/as-element [ui/date-picker]))
(defn ^:export init []
(dc/start-devcard-ui!))
I just added it now
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="../main.css" rel="stylesheet" />
<title>Limeray</title>
</head>
<body>
<div id="root"></div>
</body>
<script src="/devcards.js"></script>
<script>
limeray.web.app_test.init();
</script>
</html>
BUt having this error
//cljs-runtime/devcards.core.js:101 Uncaught TypeError: devcards.system.start_ui is not a function
oh yeah sorry. I updated the build config, changing the asset-path
and http-root
under devtools
:devcards {:target :browser
:output-dir "devcards"
:asset-path "/"
:compiler-options {:devcards true
:source-map-timestamp true}
:modules {:devcards {:entries [limeray.web.app-test]}}
:devtools {:http-port 9003
:http-root "/"
:preloads [devcards.core]}}}}
you probably need to require cljsjs.react
and maybe cljsjs.react.dom
since devcards doesn't declare its dependency on react for some reason
you shouldn't use lein-shadow
. I hate that its the default but I absolutely advise against using it.
did you restart so lein-shadow
can write it to disk so shadow-cljs can pick it up? (really stop using lein-shadow)
Hi, guys, I'm trying to run a select a nrepl nrepl-select
and starting it on a specific namespace, but I don't find any documentation for the opts
parameter of the nrepl-select
to use it. I tried to use init-ns
but didn't work.
@thheller sorry if it is a basic question. But in this case, this configuration would be in the shadow-cljs.edn
correct?
In trying to use the init-ns
to get a repl directly in the dev
namespace where I have a lot of utility functions that I use. But this is specific for me, I wouldn't like to pollute the shadow-cljs.edn
with my specific dev environment.
ideally your editor would just issue the command to switch to a given namespace when you connect
otherwise yes shadow-cljs.edn
in the build config via :devtools {:repl-init-ns some.foo}
@ctamayo ant-design fixed their imports upstream in response to my issue, so that tree shaking works out of the box with shadow now: https://github.com/ant-design/ant-design/issues/21744