This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-17
Channels
- # announcements (2)
- # asami (3)
- # babashka (30)
- # beginners (23)
- # calva (28)
- # cider (3)
- # clj-kondo (16)
- # clj-on-windows (7)
- # cljs-dev (7)
- # clojure (47)
- # clojure-austin (3)
- # clojure-europe (25)
- # clojure-gamedev (3)
- # clojure-greece (1)
- # clojure-nl (1)
- # clojure-uk (3)
- # clojurescript (54)
- # community-development (24)
- # conjure (16)
- # duct (1)
- # emacs (8)
- # events (1)
- # figwheel-main (4)
- # fulcro (13)
- # gratitude (20)
- # helix (3)
- # honeysql (8)
- # hyperfiddle (12)
- # introduce-yourself (1)
- # jobs (6)
- # lambdaisland (1)
- # lsp (35)
- # malli (1)
- # meander (27)
- # minecraft (11)
- # off-topic (12)
- # pathom (1)
- # portal (11)
- # releases (1)
- # remote-jobs (1)
- # ring (11)
- # sci (1)
- # shadow-cljs (53)
- # specter (5)
- # xtdb (20)
Why am I getting Use of undeclared Var cljs.analyzer/Throwable
with 1.11.54?
------ WARNING #2 - :undeclared-var --------------------------------------------
Resource: cljs/analyzer.cljc:4403:12
--------------------------------------------------------------------------------
4400 | []
4401 | (try
4402 | @(ns-resolve 'clojure.tools.reader '*alias-map*)
4403 | (catch Throwable t
------------------^-------------------------------------------------------------
Use of undeclared Var cljs.analyzer/Throwable
--------------------------------------------------------------------------------
4404 | nil)))
4405 |
4406 | #?(:clj
4407 | (defn forms-seq*
--------------------------------------------------------------------------------
It's also complaining about cljs.analyzer/ns-resolve
.@U06B8J0AJ it's already fixed, please use ClojureScript master and let me know if it works for you
I'm curious what you are doing since this didn't arise in the unit tests, I guess you're calling analyze-form-seq
yourself?
Honestly, I have no idea. I've been hunting for the origin of this (since no source is given except for CLJS itself). My best guess is that it's some transitive dependency. I haven't dug into those yet.
Although, hang on. Could it be this lazy-ass thing I wrote for a test seed?
(defmacro entities-in-ns
"Returns a vector of all entities defined in the supplied namespace."
[ns-symbol]
`(filterv entity? (map deref (vals (ns-publics ~ns-symbol)))))
looks like a bug introduced in 1.11.51 I guess. Throwable is a java thing, so needs to be behind a reader conditional for self-host I guess
I have some JS that I’d like to compile via :foreign-lib
so it can be live reloaded. If foo/a.js
calls require ./b.js
, is that supported? I’m trying to specify it as :provides ["foo.a"]
and :provides ["foo.b"]
, but closure isn’t finding ./b.js
. It looks like it’s searching for ./b.js
relative to my package.json, rather than relative to a.js
@arohner you're saying something a bit contradictory. If it's foreign lib - you cannot compile through Closure (technically you can, but it just doesn't work well in the general case, so you need to really know what you are doing). So not sure what you mean or what you are trying to do.
My existing build is using :target :bundle
. I have JS I wrote that is currently nodeJS and using node deps. I would like the custom JS to live reload using figwheel. AIUI, the easiest way to do that is to run the JS through Closure
ClojureScript does not understand Node.js stuff, it assumes the JS bundler will bundle all that stuff into one big thing
to clarify a bit more (:require [some-node-thing :as ...])
in your ns form is completely synthetic
there is nothing really to load, because some JS bundler already bundled the JS bits into one big file (when using :target :bundle
)
:foreign-lib
use directly can support live reload, but that's separate from :target :bundle
stuff
If I define :foreign-lib
for the npm deps of my custom JS, and then foreign lib my JS, would that work?
:foreign-lib
is an old thing that existed before Webpack and it's ilk, before people stored web libs in Node.js - remember Bower
the assumption is the JS library is read to go - has no dependencies, already compiled, etc.
in this case we load these files for you at development time, and we concatenate them in advanced builds
:target :bundle
solves a different problem - you want to use something from node_modules
- your JS is not ready to go
in fact, the JS you want to use has an complex dependency graph, or feature set only JS tools can understand
in this case we don't really load anything, we assume that you will bundle all this stuff up into one big file
based on this I would say :target :bundle
+ hot reloading some JS through Figwheel is not really practical
I haven't followed JS hot loaders because far as I can tell it is a big mess and they never got it work (to our REPL expectations) because the whole thing is conceptually broken from a Lisp viewpoint
AFAICT, the JS hotloaders also don’t work for us because they assume ESM/commonJS modules, and the CLJS hot reloaders assume closure modules
with :foreign-lib
you could setup a watching JS bundler, and then have Figwheel watch for changes to the produced .js
file if you don't need what :target :bundle
provides
Are there any https://github.com/day8/re-com alternatives? A full suite of styled clojurescript components?
And there's always an option to use a UI library directly - i.e. creating your own wrapper for it, in a way.
I personally like https://headlessui.dev
@U06B8J0AJ do you have an example in clojurescript or do you use regular react
In Reagent, you'd do something like
(def listbox
(reagent/adapt-react-class Headless/Listbox))
Follow the structure of the examples on the Headless website. Keep in mind that some things need to be converted to JS, and some keywords are different, like :className
instead of :class
, etc.
Cann't display an image from S3! Getting the image ->
{:http-xhrio {:method :get
:uri (:s3/url data)
:timeout 8000
:headers {"Content-Type" "image/*"}
:response-format (ajax/raw-response-format)
:on-success [::get-uploaded-image-success]
:on-failure [::s3-url-failure]}
}
I can see the response-->
"_response" "�PNG\r\n\n\rIHDR��\bΧ&�HiCCPICC Profile(�c``I,(�aa``��+)\nrwR���R`��� Ė\fl����>@%\f0|���\b�/��\nch���{�ѷ���X1գ����d ��3��JS�l����):\nȞb�C�@�$\b�\bXMH�3�}
............
on the reagent comp->>
[:img {:src @form-values-image}]
The image is not being displayed! But when I click on the link in the browser console, it downloads the image.
Any idea? Thanks in advance.
Hmm, I don't know anything at all about S3, but the symptoms you describe are what happens when the server sends a PNG file with a Content-Type
that's not image/png
.
Thank you. I think it is in the right direction. I uploaded a new image (png), with Content-Type, image/png. Checked on aws, and it is right. But still getting the same issue. Does the :img on the reagent comp has a content-type attr? will theck. Thanks.
Thanks again. I figured out, finally. First, I changed the seeting at AWS metadata of that image to "image/png", as previously stated. Second, I used the URL directly inside the map to :img tag in the reagent component, as shown below:
[:div.display-image [:img {:src @get-image-s3-url}]]
Thanks again.