This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-17
Channels
- # beginners (42)
- # cider (1)
- # cljs-dev (20)
- # clojure (73)
- # clojure-italy (8)
- # clojure-nl (53)
- # clojure-spec (11)
- # clojure-uk (88)
- # clojurescript (170)
- # clojutre (6)
- # core-async (26)
- # css (2)
- # cursive (13)
- # data-science (10)
- # datomic (15)
- # editors (3)
- # figwheel (28)
- # figwheel-main (67)
- # fulcro (57)
- # graphql (2)
- # immutant (2)
- # jobs (1)
- # jvm (4)
- # lein-figwheel (3)
- # leiningen (1)
- # off-topic (5)
- # pedestal (28)
- # re-frame (86)
- # reagent (18)
- # reitit (8)
- # ring (3)
- # ring-swagger (2)
- # shadow-cljs (78)
- # spacemacs (10)
- # specter (12)
- # tools-deps (32)
- # vim (3)
Hi @thheller I’m trying to use posh library in my project. It produces error when load because it calls clojure.walk/postwalk
function. In according to ClojureScript documentation https://www.clojurescript.org/about/differences clojure.walk
namespace is included to ClojureScript. It works fine with lein and figwheel, but looks like there is no such namespace when I compile it in shadow-cljs
. Any thoughts how to fix this?
Interesting, if I require [clojure.walk :as walk]
and then use it inside my code (even like clojure.walk/postwalk
), it works. But if I use it without requiring in this particular namespace, and just use clojure.walk/postwalk
it fails. In general case I would just require it, but it’s library code, not mine
@viebel the browser
key is fully supported and I tested including aws-sdk
and it worked fine. what error do you get?
maybe in my case it doesn't work due to :lein true?
@denis_krivosheev code must always be required properly to work yes. you might be able to make it work if you include clojure.walk
before including the library. shadow-cljs
is a bit stricter about requires due to the parallel compilation
let me try again
I get this error:
Compiling ClojureScript...
Compiling ["public/clojurescript/main.js"] from ["src/cljs/audyx"]...
events.js:183
throw er; // Unhandled 'error' event
^
Error: module not found: "fs" from file /mnt/c/Users/USER/prj/audyx-deps/node_modules/aws-sdk/lib/util.js
at onresolve (/mnt/c/Users/USER/prj/audyx-deps/node_modules/@cljs-oss/module-deps/index.js:181:30)
at onResolve (/mnt/c/Users/USER/prj/audyx-deps/node_modules/enhanced-resolve/lib/Resolver.js:70:11)
at innerCallback (/mnt/c/Users/USER/prj/audyx-deps/node_modules/enhanced-resolve/lib/Resolver.js:143:22)
at callbackWrapper (/mnt/c/Users/USER/prj/audyx-deps/node_modules/enhanced-resolve/lib/createInnerCallback.js:10:21)
at next (/mnt/c/Users/USER/prj/audyx-deps/node_modules/tapable/lib/Tapable.js:249:35)
at innerCallback (/mnt/c/Users/USER/prj/audyx-deps/node_modules/enhanced-resolve/lib/Resolver.js:143:22)
at callbackWrapper (/mnt/c/Users/USER/prj/audyx-deps/node_modules/enhanced-resolve/lib/createInnerCallback.js:10:21)
at next (/mnt/c/Users/USER/prj/audyx-deps/node_modules/tapable/lib/Tapable.js:249:35)
at resolver.doResolve.createInnerCallback (/mnt/c/Users/USER/prj/audyx-deps/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:41:24)
at callbackWrapper (/mnt/c/Users/USER/prj/audyx-deps/node_modules/enhanced-resolve/lib/createInnerCallback.js:10:21)
@thheller requiring it before the library doesn’t work either
I have :lein true
(ns differ.core
(:require
[datascript.core :as datascript]
[expound.alpha :as expound]
[orchestra-cljs.spec.test :as st]
[cljs.spec.alpha :as s]
[clojure.walk :as walk] ;; <- here
[re-posh.core :as re-posh])) ;; <- this library using it
@viebel that doesn't matter. you are not currently using shadow-cljs. I don't know what exactly you are doing but the above error is not produced by shadow-cljs
@denis_krivosheev you can take this file https://github.com/mpdairy/posh/blob/master/src/posh/lib/pull_analyze.cljc
oh, great idea!! thanks!
what is the order of classpath walking? my code first or library first?
cool! Great thanks!
Yeah, will create a PR to them
@thheller one more thing in my console. I’m building project with target :npm-module
and use it from javascript as in your example project. When it starts it throws an error:
Uncaught ReferenceError: SHADOW_ENV is not defined
even if I start it this way: SHADOW_ENV=development shadow-cljs watch app
Yeah, it’s just my gues. But how to fix this?
The same error in your example project
yeah, in this one https://github.com/shadow-cljs/examples/tree/master/cljs-react-app
{:source-paths
["cljs-src" "cljs-test"]
:nrepl {:port 8450}
:dependencies
[[org.clojure/clojurescript "1.10.339"]
[org.clojure/clojure "1.9.0"]
[reagent "0.8.1"]
[datascript "0.16.6"]
[orchestra "2017.11.12-1"]
[expound "0.7.1"]
[re-posh "0.3.0"]]
:builds
{:app {:target :npm-module
:output-dir "dist/cljs"
:runtime :browser
:entries [differ.core differ.chat.views]}
:test {:target :node-test
:output-to "dist/cljs/test"}}}
I’m using it the same way as in example, except I use not node_modules
but just a folder inside my project
Yes, the error is in runtime. Browser chrome
any particular reason you are not using :target :browser
instead? do you need anything from CRA?
I wanna migrate my project to clojurescript, but it’s big and there is no way I can rewrite it from scratch. It’s TypeScript and I need interop from TypeScript to ClojureScript and vice versa
I think the :runtime :browser
might be causing some confusion. I just tested with node which works fine.
$ lein run -m shadow.cljs.devtools.cli help
Unknown action.
What might I be doing wrong?browser.cljs:39 Uncaught ReferenceError: SHADOW_ENV is not defined
at Object.shadow$cljs$devtools$client$browser$goog_is_loaded_QMARK_ [as goog_is_loaded_QMARK_] (browser.cljs:39)
at shadow$cljs$devtools$client$browser$src_is_loaded_QMARK_ (browser.cljs:48)
at Function.G__24616__1 [as cljs$core$IFn$_invoke$arity$1] (core.cljs:4222)
at cljs.core.filter.cljs$core$IFn$_invoke$arity$2 (core.cljs:5124)
at cljs.core.LazySeq.sval (core.cljs:3394)
at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (core.cljs:3452)
at Object.cljs$core$seq [as seq] (core.cljs:1210)
at Function.cljs.core.seq_reduce.cljs$core$IFn$_invoke$arity$3 (core.cljs:2445)
at cljs.core.LazySeq.cljs$core$IReduce$_reduce$arity$3 (core.cljs:3458)
at Function.cljs.core.reduce.cljs$core$IFn$_invoke$arity$3 (core.cljs:2517)
@tomi.hukkalainen_slac not using shadow-cljs help
😉
@thheller also I’m using shadow-cljs 2.4.20
maybe it’s the reason
@tomi.hukkalainen_slac the help
command is more or less useless regardless but currently its implremented only on the CLJS side so its just missing
@denis_krivosheev nah found the issue its in the live reloading code
ah, cool
@denis_krivosheev should be fixed in 2.4.21
Great! thank you!
@thheller tested. Fixed. Great job! shadow-cljs rocks :the_horns:
@thheller I was wondering if I should make a repository, that builds a ring-jetty backend and shadow/re-frame frontend commit by commit, documenting the commands in the README (as some of the files in the repo are not written by hand)?
Hm. How do I tell shadow not to use the version of a an npm library packaged under dist, but instead the non-minified src version, for debugging/development?
Gah. :js-options :resolve seems to do the trick, but the library is actually jsx, which wasn't really visible from the filenames
Any hints on what to do when (server/start!)
doesn’t return, as in the example at https://shadow-cljs.github.io/docs/UsersGuide.html#embedded. It just hangs with no output.
Hmm… It does start under a boot repl
, but not under a clj (deps.edn) repl… Any ideas to get it started under clj
?
Just (server/start!)
Hmm. I had some other things in my deps.edn as well, but when stripping that out and running a deps.edn with just shadow-cljs in, it does this:
% clj
Clojure 1.9.0
user=> (require '[shadow.cljs.devtools.server :as server])
nil
user=> (server/start!)
Jul 17, 2018 7:03:33 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Jul 17, 2018 7:03:33 PM clojure.tools.logging$eval8756$fn__8759 invoke
WARNING: HTTP startup failed
java.lang.IllegalArgumentException: XNIO001001: No XNIO provider found
at org.xnio.Xnio.doGetInstance(Xnio.java:270)
at org.xnio.Xnio.getInstance(Xnio.java:187)
at io.undertow.Undertow.start(Undertow.java:116)
at shadow.undertow$start.invokeStatic(undertow.clj:194)
at shadow.undertow$start.invoke(undertow.clj:158)
at shadow.cljs.devtools.server$start_http$fn__22410.invoke(server.clj:136)
at shadow.cljs.devtools.server$start_http.invokeStatic(server.clj:135)
at shadow.cljs.devtools.server$start_http.invoke(server.clj:131)
at shadow.cljs.devtools.server$start_system.invokeStatic(server.clj:180)
at shadow.cljs.devtools.server$start_system.invoke(server.clj:154)
at shadow.cljs.devtools.server$start_BANG_.invokeStatic(server.clj:349)
at shadow.cljs.devtools.server$start_BANG_.invoke(server.clj:283)
at shadow.cljs.devtools.server$start_BANG_.invokeStatic(server.clj:286)
at shadow.cljs.devtools.server$start_BANG_.invoke(server.clj:283)
at user$eval22617.invokeStatic(NO_SOURCE_FILE:3)
at user$eval22617.invoke(NO_SOURCE_FILE:3)
at clojure.lang.Compiler.eval(Compiler.java:7062)
at clojure.lang.Compiler.eval(Compiler.java:7025)
at clojure.core$eval.invokeStatic(core.clj:3206)
(Not hanging anymore though)
And upgrading tools.deps fixed the XNIO problem
And now it works with the other stuff I had in deps.edn as well. So basically, an upgrade of tools.deps (and clojure) made it work.
ah right. yeah older versions of tools.deps didn't support :scope "runtime"
which the xnio stuff uses.
Hmm… It does start under a boot repl
, but not under a clj (deps.edn) repl… Any ideas to get it started under clj
?
@urbanslug the vals
issue you ran into earlier was actually a bug in shadow-cljs which should be fixed in 2.4.22