This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-20
Channels
- # announcements (16)
- # babashka (71)
- # beginners (121)
- # bristol-clojurians (2)
- # calva (55)
- # clj-kondo (16)
- # clojure (103)
- # clojure-europe (9)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-spec (49)
- # clojure-uk (57)
- # clojurescript (28)
- # conjure (9)
- # cursive (6)
- # datascript (3)
- # datomic (35)
- # duct (20)
- # events (3)
- # figwheel-main (12)
- # fulcro (6)
- # graalvm (12)
- # juxt (3)
- # kaocha (5)
- # lumo (10)
- # malli (5)
- # off-topic (54)
- # pathom (8)
- # re-frame (19)
- # reitit (21)
- # remote-jobs (1)
- # shadow-cljs (102)
- # sql (38)
- # tools-deps (60)
- # uncomplicate (3)
- # xtdb (10)
I've noticed in my shadow-cljs project that when there is an error I don't get any useful line number -- just a bunch of references to browser.cljs
. Is this a shadow-cljs limitation or a Clojurescript one, and is there something I can do about it?
I keep hearing that CLJS has very well-engineered source maps, but it's pretty frustrating to get a basic arity error or something of that nature and have zero idea where it's coming from. I'm hacking on a small project with Clojure right now, but if it grows searching around blindly until I figure out what section of the code an error came from definitely isn't going to be maintainable
Oh and this is running in watch
-mode, if that has anything to do with it
@mail985 you need to be a bit more specific. I have no clue what your problem is. make screenshot or something that shows what you are talking about.
I can't seem to get css reloading working. I have a hiccup-generated page loading a css file at "/css/view.css"
, which on the fs is at resources/public/css/view.css
. I'm not using :dev-http
so I have {:target :browser ... :devtools {:watch-dir "public" ...}
in shadow-cljs.edn. does that look right? maybe I'm missing something in deps.edn? shadow command is server
hm.. I swear I had already tried that but I just tried it again and it worked. thanks :P
maybe I was thrown off by the loading spinner that pops up on the HUD when shadow-cljs.edn is edited, but didn't restart the server
I have a problem with (:require ["docx4js"])
with :target :react-native
, it works, but with :target :browser
it throws
[:app] Build failure:
The required JS dependency "/node_modules/docx4js/lib" is not available, it was required by "shadow.js.shim.module$node_modules$docx4js$lib$props.js".
Dependency Trace:
r8/contree/styled_system.cljs
node_modules/docx4js/lib/index.js
node_modules/docx4js/lib/openxml/docx/document.js
node_modules/docx4js/lib/openxml/document.js
node_modules/docx4js/lib/document.js
shadow.js.shim.module.js
Apparently it trips over requiring node_modules/docx4js/lib/$props.js
ah. of course there are npm files that have $
in their name ... why wouldn't there be π
due to https://clojure.atlassian.net/browse/CLJS-3235 that is now a special char. guess I'll have to disable that functionality for node_modules
...
no clue if you are even on a version with that feature yet. don't have time to look into the issue right now but it'd be my guess that its $
I have a .cljc
file which uses a namespaced keyword in a :clj
branch. When trying to evaluate that in a CLJS REPL, it barfs:
(cljs.core/load-file "/Users/lilactown/Code/amperity/app/service/web/web-ui/src/amperity/web/mx_segment/core.cljs")
------ ERROR -------------------------------------------------------------------
File: /Users/lilactown/Code/amperity/app/service/segment/segment-core/src/clj/amperity/mx_segment/folder.cljc:52:20
--------------------------------------------------------------------------------
49 | (do
50 | (pc/defresolver list-resolver
51 | [{:keys [tree] :as env} _input]
52 | {::pc/output [{::all config-keys}]}
--------------------------^-----------------------------------------------------
amperity/mx_segment/folder.cljc [line 52, col 20] Invalid keyword: ::pc/output.
--------------------------------------------------------------------------------
53 | (d/chain
54 | (list tree)
55 | (fn [seg-list]
56 | {::all seg-list})))
--------------------------------------------------------------------------------
the namespace only exists in the :clj
branch as well, so if the reader is trying to interpret it it makes sense why it would barf. I would just expect it skip it since itβs in a reader conditional
full offending code:
#?(:clj
(do
(pc/defresolver list-resolver
[{:keys [tree] :as env} _input]
{::pc/output [{::all config-keys}]}
(d/chain
(list tree)
(fn [seg-list]
{::all seg-list})))
(pc/defresolver get-resolver
[{:keys [tree] :as env} {:keys [::id] :as input}]
{::pc/input #{::id}
::pc/output [{::node config-keys}]}
(d/chain
(get tree id)
(fn [node]
{::node node})))))
@lilactown either branch of the code must still be readable and as such must have that alias. not anything shadow-cljs can do anything about.
itβs pathom, so it is cljc. Iβd rather not include all of pathom in my bundle if not necessary tho
like I said .. only the alias needs to exist. doesn't matter what it points to (:require [clojure.string :as pc])
Regarding aliases, may I direct your attention to https://clojure.atlassian.net/browse/CLJ-2030 and https://clojure.atlassian.net/browse/CLJ-2123
another question: I recently updated to 2.10.21. Iβm now receiving an error on release:
--- amperity/web/stitch/report_v2/viz.js:1
Cannot import Closure files by path. Use either import goog:namespace or goog.require(namespace)
this file is an es module - I remember rewriting it from a goog module to es syntax
or is there some way that I need to signal that it is in fact an es module, and not a goog module? (other than use import
and export
, which it does)
Not sure if that will answer your question, but I'm adding node modules in a separate source folder and make them available as package.json
dependencies
: "local-package": "file:./local-package-src"
not nothing should have changed in that regard. but it bumped closure which tends to change stuff ...
@bendlas I think this particular aliasing problem warrants a new issue. given that the code is immediately discarded anyways it shouldn't attempt to resolve it.
You mean about the missing ::alias/ns
behind a read-cond
? Yeah, that would be good to get fixed in the reader ...
I never tried but symbols may have the same problem. but yes on read-cond branches that aren't active a missing alias shouldn't break the code.
Unfortunately, clojure.tools.reader/*alias-map*
seems to be the only facility for that. I guess that could be hacked, by implementing ILookup
, but there would be many open questions then, about how to proceed after read-cond has been resolved ...
oh, it does: https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/read
is there a known good version I can downgrade to w.r.t. es module issue, thatβs better than going back to what I was on (2.8.61 π )
ostensibly https://github.com/thheller/shadow-cljs/commit/22b078a77444cc99ba22a87277f82286f0f90437
Seems lile that lib does more freaky stuff, that we're tripping over:
β’ require("f" + "s")
at https://github.com/lalalic/docx4js/blob/84ae60e0395e3cef066055d11392732b65c76d90/lib/document.js#L206
[:app] Compiling ...
[2020-08-21 11:47:11.520 - INFO] :shadow.build.npm/js-invalid-requires - {:resource-name "node_modules/docx4js/lib/document.js", :requires [{:line 206, :column 14}]}
Then there is
[:app] Build failure:
The required JS dependency "entities/maps/entities.json" is not available, it was required by "node_modules/htmlparser2/lib/Tokenizer.js".
Dependency Trace:
r8/contree/styled_system.cljs
node_modules/docx4js/lib/index.js
node_modules/docx4js/lib/openxml/docx/document.js
node_modules/docx4js/lib/openxml/document.js
node_modules/docx4js/lib/document.js
node_modules/docx4js/lib/$props.js
node_modules/cheerio/index.js
node_modules/cheerio/lib/cheerio.js
node_modules/cheerio/lib/parse.js
node_modules/htmlparser2/lib/index.js
node_modules/htmlparser2/lib/Parser.js
node_modules/htmlparser2/lib/Tokenizer.js
, where it refers to node_modules/entities/lib/maps/entities.json
. Not sure, if that's related to the other error, somehow ..thats probably a version conflict. like expecting an older/newer version of entities
yeah dynamic requires like the faked require("fs")
are just to hide them from packagers. pretty stupid but I guess thats common in the JS world
:target :react-native
does no bundling whatsoever by shadow-cljs. its all done by react-native metro
and they are happy to include 2 versions of the same library. so you just get entities
twice
oh right, it's there 3 times
entities
htmlparser2/node_modules/entities
cheerio/node_modules/entities
fun times .. then you get 3 versions of it in react-native. totally doesn't bloat your final bundle at all π
... as opposed to maven's randomly changing your version. it's really pest vs cholera π
you can set :js-options {:resolve {"entities/maps/entities.json" {:target :npm :require "entities/lib/maps/entities.json"}}}
I think. never actually tried using it to override direct references but it should work
the dynamic require is just a warning, and I'm not hitting the require("fs")
path in the browser anyway
@thheller at my new job we are doing a lot of serverless stuff so I end up having to jump into cloudwatch and copy and pasting edn a bunch. I am wondering if there is a way I can leverage tap>
from within the AWS lambdas and point it at a kind of IRC Bouncer/inbox style thing and then pick the tap>
ed values up on my local machine using shadow inspect
you could automate the EDN copying. if you get it to your shadow-cljs instance you can just tap>
it from CLJ
After I moved to an Electron app, I began getting this async-dispatch-N
error when I shadow-cljs watch renderer
. It happens non-deterministically, and usually mentions @material-ui/icons
. The build is `
:renderer {:target :browser
:output-dir "resources/public/js/compiled"
:asset-path "js/compiled"
:modules {:renderer {:init-fn athens.core/init}}
:compiler-options {:closure-warnings {:global-this :off}
:closure-defines {re-frame.trace.trace-enabled? true}}
:devtools {:preloads [devtools.preload
day8.re-frame.trace.preload]}}
@tangj1122 only guess I have is that you maybe have a bad core.async version
but could be a simple overload. @material-ui/icons
adds thousands of files to your build. I fixed something to that extent in some version. can't remember which.