is there a good reagent template with routing (frontend only?)
the most popular libraries for client side routing are reitit (maintained), bidi (maintained) and secretary (popular but last commit on aug 2019), sadly I don't know any templates, by each repo has examples that you can check
Is it normal to see a DevTools message in prod? How can I resolve this?
DevTools failed to load SourceMap: Could not parse content
for
<https://xxx/js/Loading.js.map>:
Unexpected token < in JSON at position 0
I get this error as well.
[6:49 AM] Warning: React.createElement: type is invalid -- expected a
string (for built-in components) or a class/function (for
composite components) but got: undefined. You likely forgot
to export your component from the file it's defined in, or
you might have mixed up default and named imports.
Check the render method of `lba`.
in lba (created by mba)
in Suspense (created by M4)
in M4 (created by mba)
in mba (created by $$)
in $$
in Unknown (created by class_1)
in class_1
the first error looks like it's trying to load an html page (possibly a 404 response) for the sourcemap
you can check by loading
<https://xxx/js/Loading.js.map>
the second error looks like an issue with advanced compilation. you can try the tips from https://clojurescript.org/reference/advanced-compilation#fixing-advanced-compilation-issues to debug
@nedim Check out https://roman01la.github.io/javascript-to-clojurescript/ it has made life a lot easier for this kind of stuff
How do I know where and when to provide an extern?
I have this warning currently -
Adding extern to Object for property configure due to ambiguous expression (. Amplify/default configure (->js {:Auth {:identityPoolId config/IDENTITY_POOL_ID, :region config/REGION, :userPoolId config/USER_POOL_ID, :userPoolWebClientId config/USER_POOL_WEB_CLIENT_ID, :oauth {:domain config/OAUTH_DOMAIN, :redirectSignIn config/OAUTH_REDIRECT_SIGN_IN, :redirectSignOut config/OAUTH_REDIRECT_SIGN_OUT, :scope ["phone" "email" "profile" "openid" "aws.cognito.signin.user.admin"], :responseType "code"}}}))
usually whenever you're using a javascript library. using a clojurescript library is more straightforward and doesn't require externs
if you're planning on using js libraries, I would consider using shadow-cljs
looks like amplify js in on npm, which means you can shadow-cljs to do a lot of the work for you
getting set up can be a bit daunting, but it works pretty well once you do
There is a project that is set-up (not using shadow-cljs). Everything was working until I did a cljs upgrade
does it work despite the warnings? or do you eventually get an error or unexpected behavior?
Locally it works despite the warning. In advanced compilation I am wondering if this is what is causing the error.
When I run advanced compilation, I get no errors with the warning
But than the app doesn't work
how are you defining react components?
based off the react warnings, my guess is that the components aren't created in a way amenable to advanced compilation
i am using the helix wrapper
hmmm, there is a #helix channel
which might be more helpful. I've heard of helix, but I've never used it
okay Thanx. Will try there
I would start with:
> Change your production build to use two additional options :pseudo-names true
and :pretty-print true
.
to see if that helps narrow down where the issue might be
So I have :pseudo-names true
it won't fix the error, but it should hopefully give you a more useful name to lookup in your code than lba
, mba
, etc
Absolutely, I don't know what to do with lba
mba
Hello all, has anybody in this forum worked on MSAL library for a clojurescript project ? I seek some help on LoginRedirect method. Thank you. I tried to search for any messages related to msal did not find any, so, was curious to ask and I am sure I am not alone in this world.
Hello folks, I was reading The Joy of Clojure
and in the chapter 13 there are some examples explaining how ClojureScript compile process works. I followed step by step but I'm getting Execution error (NullPointerException) at cljs.analyzer/excluded? (analyzer.cljc:3813).
null
when trying to use cljs.analyze
for generate ast
. Can someone help me on that please?
compilation.cljs:
(ns joy.compilation
(:require [cljs.analyzer.api :as api]
[cljs.analyzer :as ana]
[cljs.compiler :as comp]))
(def code-string "(defn hello [x] (js/alert (pr-str 'greetings x)))")
(def code-data (clojure.edn/read-string code-string))
(def ast (ana/analyze (assoc (ana/empty-env) :content :expr) code-data))
(comp/emit ast)
Execution error (NullPointerException) at cljs.analyzer/excluded? (analyzer.cljc:3813).
null
project.clj:
(defproject joy/music "1.0.0"
:dependencies [[org.clojure/clojure "1.10.1"]
[org.clojure/clojurescript "1.10.764"]]
:plugins [[lein-cljsbuild "1.1.8"]]
:cljsbuild
{:builds
[{:source-paths ["src/cljs"]
:compiler
{:output-to "dev-target/all.js"
:optimizations :whitespace
:pretty-print true}}
{:source-paths ["src/cljs"]
:compiler
{:output-to "prod-target/all.js"
:optimizations :advanced
:pretty-print false}}]})
@lucas_s.s book examples that rely on the ClojureScript compiler are a bit dodgy because it changes quite a bit and The Joy of Clojure was published some time ago
I think the easiest way to poke around in the compiler is still to look at the tests
you can also mess around here to some degree - https://swannodette.github.io/2015/07/29/clojurescript-17/
I need to update my blog - but one benefit is that is the version of compiler is stuck at whatever it was when I released that post
there maybe other CLJS compiler stuff on the web out there - not sure - I'm assuming you're mostly just interested in the flow from s-expressions to AST
so using Clojure or ClojureScript to see that doesn't seem all that important
How would i approach (deref (future ...) 500)
in cljs ?
you want to block on a pending value?
assuming deref
not defer
Yes, indeed.
not possible to block in js. there's a notion of promises with callbacks or you could use async to "park"
Thanks, I'll hammock about another approach
It's an awesome article, thank you so much for share it with me 💜
Hello Folks,
somehow my upgrading of cljs to 1.10.741 or higher results in:
Uncaught TypeError: $<http://jscomp.Lb|jscomp.Lb> is not a function
Simply returning to 1.10.587 makes it work again. Has anybody seen this before?
Hi, i am just getting started on ClojureScript. Past few months worked on few clojure code & comfortable with ring/compjure/clj-http etc. Can someone help me with pointer on how to move ahead with building a simple cljs project like below. A single page application, displays a tabular view and brings the weather/stock data from some opensource api via async call and render it on page load.
That's the final piece and you can build the full UI first, then add the Data Source (via either just cljs interop with js/fetch (lookup window.fetch) or r0man/cljs-http that uses core.async)
Yeah, probably the way to go is js/Promise + <p!
from core.async. "Fakes" to do kind of what you're asking for https://clojurescript.org/guides/promise-interop#using-promises-with-core-async
A read-through and trying to replicate what's in the Reagent starter is a good start: https://reagent-project.github.io/
(granted you know HTML)
I have stumbled upon this issue from 2018 that says that "`js->clj` is not safe for arbitrary JSON data". Is that still the case? https://github.com/JulianBirch/cljs-ajax/issues/219#issuecomment-425851029
depends on the data but yes