This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-03
Channels
- # announcements (1)
- # babashka (22)
- # beginners (176)
- # calva (10)
- # cider (4)
- # circleci (5)
- # cljsrn (20)
- # clojure (28)
- # clojure-europe (11)
- # clojure-italy (5)
- # clojure-nl (5)
- # clojure-spec (1)
- # clojure-sweden (2)
- # clojure-uk (29)
- # clojuredesign-podcast (4)
- # clojurescript (38)
- # code-reviews (25)
- # conjure (1)
- # core-typed (1)
- # data-science (16)
- # datomic (23)
- # figwheel-main (16)
- # fulcro (48)
- # helix (9)
- # jobs (3)
- # juxt (5)
- # kaocha (17)
- # malli (19)
- # mount (9)
- # nrepl (4)
- # off-topic (35)
- # pathom (7)
- # re-frame (28)
- # reagent (26)
- # reitit (1)
- # releases (1)
- # remote-jobs (5)
- # sci (6)
- # shadow-cljs (36)
- # spacemacs (3)
- # sql (8)
- # tools-deps (13)
- # unrepl (1)
- # vim (4)
- # xtdb (8)
Hi, i have a question about the required fields in ns declaration. Is a string not required for a npm package now ?? I mean:
(ns foo (:require ["react" :as react]))
is now
(ns foo (:require [react :as react])) ??
Because i'am getting this error in my repl (emacs/cider):
<< could not find string alias for "react" from foo >>
and when i change to the no string version it works fine.
But how now i require something like ["@material-ui/core" :as mui] ??? i cant have a no string version because of the the @ operator!
I asking here in shadow-cljs channel because i think it start to happens after i upgraded shadow-cljs from npm to the last version 2.10.13.@neural.works.com strings are always preferred for JS dependencies
not sure why you are getting that error. do you have more context for what you are doing?
in my experience of both, shadow-cljs feels more tightly integrated with the existing node ecosystem. you npm install shadow-cljs
into your project and use a package.json
rather than having the project.clj
manage dependencies. importing node modules into frontend code seems smoother than it was under lein
+ figwheel. i am a big fan of figwheel, but i have not used figwheel for a few months and things might have changed. shadow-cljs.edn
is far more concise for the most common use-cases than project.clj
.
oh sorry
i don't have experience with it
Hey everyone! Getting started with shadow-cljs and experimenting with Preact.
Couple of questions:
1.
import "preact/debug";
would normally activate the debugging tools .
Using it as such did in fact add the debugging tools to window as the developer extensions expected but it seems it something is off because it could not hook into the rendering process.
(ns
(:require ["preact/debug"]
["preact" :as preact]))
2. Preact offers a React compatibility layer. Do you think it would be possible to "trick" shadow.markup.react
into working with Preact?@pcasaretto dont use shadow.markup.react
but yes you can trick everything into using preact by just rewriting the react requires https://shadow-cljs.github.io/docs/UsersGuide.html#js-resolve-npm
you probably want to move the preact/debug
to :preloads ["preact/debug"]
so its only included in dev builds
@borkdude I've never used figwheel in any real project so I won't even start to make comparisons. The things I focussed on with shadow-cljs is easier configs with better defaults. better support for :modules
/ code-splitting and useful things for release builds like [build-reports](https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report)
if you instead just want a tool that works with minimal config and lets you get on with your project it might be 😉
npm integration is also a bit smoother since you don't have to worry about webpack or anything on that front
my team lead isn't fond of npm in general so having to install npm to run the build may put him off
well if you intend to use npm packages via :bundle
then you'll install that regardless
if you just want CLJSJS then definitely do not use shadow-cljs since it doesn't even support those packages
https://code.thheller.com/blog/shadow-cljs/2017/11/18/the-many-ways-to-use-shadow-cljs.html
Shadow-cljs not working with CLSJS is a feature, not a bug. You don’t need CSJS anymore since you can so easily work directly with native npm libraries. No need to create brittle CLJSJS versions of all the libraries you want. Life is so much better this way. You can use just about any npm library you might need.
CLJSJS is not supported at all yes https://shadow-cljs.github.io/docs/UsersGuide.html#cljsjs
https://code.thheller.com/blog/shadow-cljs/2017/09/15/js-dependencies-the-problem.html
@thheller Hi Thomas, when changing ns i am get this problem only when using strings in JS dependencies.
cljs.user=> (ns site.core)
[2020-07-03 13:59:18.978 - WARNING] :shadow.cljs.devtools.server.worker.impl/cljs-compile-ex - {:input {:code "(ns site.core)", :ns cljs.user, :repl true}}
ExceptionInfo Failed to process REPL command {:eof? false, :ns cljs.user, :form (ns site.core), :source "(ns site.core)", :tag :shadow.cljs.repl/process-ex}
shadow.cljs.repl/process-read-result (repl.clj:519)
shadow.cljs.repl/process-read-result (repl.clj:493)
shadow.cljs.repl/process-input (repl.clj:673)
shadow.cljs.repl/process-input (repl.clj:657)
shadow.cljs.devtools.server.worker.impl/fn--14381 (impl.clj:755)
shadow.cljs.devtools.server.worker.impl/fn--14381 (impl.clj:745)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
shadow.cljs.devtools.server.util/server-thread/fn--14044/fn--14045/fn--14053 (util.clj:285)
shadow.cljs.devtools.server.util/server-thread/fn--14044/fn--14045 (util.clj:284)
shadow.cljs.devtools.server.util/server-thread/fn--14044 (util.clj:257)
java.lang.Thread.run (Thread.java:748)
Caused by:
ExceptionInfo could not find string alias for "react" from site.core {:require-from-id site.core, :require "react"}
shadow.build.data/get-string-alias (data.clj:139)
shadow.build.data/get-string-alias (data.clj:135)
shadow.build.ns-form/rewrite-js-deps/fn--9175 (ns_form.clj:639)
clojure.lang.PersistentArrayMap.kvreduce (PersistentArrayMap.java:377)
clojure.core/fn--8437 (core.clj:6845)
clojure.core/fn--8437 (core.clj:6830)
clojure.core.protocols/fn--8167/G--8162--8176 (protocols.clj:175)
clojure.core/reduce-kv (core.clj:6856)
clojure.core/reduce-kv (core.clj:6847)
shadow.build.ns-form/rewrite-js-deps (ns_form.clj:636)
shadow.build.ns-form/rewrite-js-deps (ns_form.clj:628)
shadow.cljs.repl/repl-ns (repl.clj:340)
------ REPL Error while processing ---------------------------------------------
(ns site.core)
could not find string alias for "react" from site.core
{:require-from-id site.core, :require "react"}
ExceptionInfo: could not find string alias for "react" from site.core
shadow.build.data/get-string-alias (data.clj:139)
shadow.build.data/get-string-alias (data.clj:135)
shadow.build.ns-form/rewrite-js-deps/fn--9175 (ns_form.clj:639)
clojure.lang.PersistentArrayMap.kvreduce (PersistentArrayMap.java:377)
clojure.core/fn--8437 (core.clj:6845)
clojure.core/fn--8437 (core.clj:6830)
clojure.core.protocols/fn--8167/G--8162--8176 (protocols.clj:175)
clojure.core/reduce-kv (core.clj:6856)
clojure.core/reduce-kv (core.clj:6847)
shadow.build.ns-form/rewrite-js-deps (ns_form.clj:636)
shadow.build.ns-form/rewrite-js-deps (ns_form.clj:628)
shadow.cljs.repl/repl-ns (repl.clj:340)
shadow.cljs.repl/repl-ns (repl.clj:328)
shadow.cljs.repl/process-read-result (repl.clj:513)
shadow.cljs.repl/process-read-result (repl.clj:493)
shadow.cljs.repl/process-input (repl.clj:673)
shadow.cljs.repl/process-input (repl.clj:657)
shadow.cljs.devtools.server.worker.impl/fn--14381 (impl.clj:755)
shadow.cljs.devtools.server.worker.impl/fn--14381 (impl.clj:745)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
shadow.cljs.devtools.server.util/server-thread/fn--14044/fn--14045/fn--14053 (util.clj:285)
shadow.cljs.devtools.server.util/server-thread/fn--14044/fn--14045 (util.clj:284)
shadow.cljs.devtools.server.util/server-thread/fn--14044 (util.clj:257)
java.lang.Thread.run (Thread.java:748)
It compiles fine, the problem is in repl@neural.works.com please open a github issue otherwise this will get lost