This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-05
Channels
- # announcements (1)
- # babashka (6)
- # beginners (37)
- # clojure (4)
- # clojure-europe (6)
- # clojure-india (3)
- # clojure-spec (6)
- # clojured (1)
- # clojurescript (14)
- # datalog (5)
- # gratitude (1)
- # helix (3)
- # hyperfiddle (1)
- # interop (6)
- # leiningen (2)
- # off-topic (142)
- # other-lisps (2)
- # pathom (20)
- # releases (1)
- # rewrite-clj (4)
- # shadow-cljs (5)
- # tools-deps (3)
I have the following code that I want to compile and run on node.js
(ns fixtures.kitchen-sink
(:require
["react" :as react]
["react-dom/server" :as rdom]))
(defn -main []
(prn (rdom/renderToString (react/createElement "div" nil "hi"))))
(ns fixtures.asdf
(:require
["react" :as react]))
(react/createElement "div" nil "foo")
and then
(ns fixtures.kitchen-sink
(:require
fixtures.asdf
,,,)
$ clojure -A:test -m cljs.main -m fixtures.kitchen-sink -re node
WARNING: Implicit use of clojure.main with options is deprecated, use -M
(node:14799) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling <anonymous> on process.)
(Use `node --trace-deprecation ...` to show where the warning was created)
Execution error (ExceptionInfo) at cljs.repl/evaluate-form (repl.cljc:577).
Execution error (Error) at (<cljs repl>:1).
Cannot find module 'react'
Require stack:
- /private/var/folders/07/jvdsvczj0975zzwkmwj23ydh0000gn/T/out825168205526329496285569366295375/fixtures/arst.js
@lilactown looks like the JS is run in some temp folder. look for a setting that would change it so it runs in your project? maybe the output-dir setting? dunno what that is for cljs.main but should be something like that?
yeah I switched to calling cljs.build.api/build
directly and then node
on the output and it is working
I saw that there is Next that builds upon React, and Nuxt that does same with Vue. Is there anything similar that builds upon Re-frame to make a multipage web app with clojurescript ?
@U03HPBZUNS2 Do you know Inertia.js? It's a solution that allows you to handle most of the work at the backend level, thus simplifying the front-end and managing the SSR. https://inertiajs.com/
I wrote this Clojure adapter: https://github.com/prestancedesign/inertia-clojure
I haven't documented SSR yet but you can check out the ssr
branch of this demo app: https://github.com/prestancedesign/pingcrm-clojure/tree/ssr
Very nice, and can I deploy it on vercel, netlify, githubpages or something like that ? or I have to deploy it on a server like DigitalOcean ?
Thanks 🙂 Yes for sure, you can deploy on Netlify and DigitalOcean. The PingCRM demo is currently running on DO. AFAIK, for Vercel it's not possible. There is no Clojure/JVM runtimes for the back end. LMK if you have some questions.