This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-04
Channels
- # announcements (19)
- # babashka (11)
- # babashka-sci-dev (9)
- # beginners (71)
- # calva (25)
- # cider (1)
- # clara (36)
- # clj-kondo (47)
- # clojure (65)
- # clojure-dev (64)
- # clojure-europe (9)
- # clojure-nl (2)
- # clojure-seattle (1)
- # clojure-uk (2)
- # clojured (8)
- # clojurescript (17)
- # cursive (9)
- # data-science (36)
- # datahike (11)
- # emacs (10)
- # figwheel-main (19)
- # fulcro (15)
- # graalvm (12)
- # humbleui (5)
- # introduce-yourself (3)
- # jobs (10)
- # leiningen (4)
- # lsp (24)
- # malli (7)
- # nextjournal (23)
- # off-topic (1)
- # pedestal (2)
- # polylith (6)
- # portal (1)
- # re-frame (3)
- # reitit (2)
- # releases (2)
- # remote-jobs (1)
- # reveal (9)
- # shadow-cljs (13)
- # spacemacs (6)
- # xtdb (3)
This is a sort-of newbie question, forgive me if it's obvious.
I have an existing javascript project using webpack, and I've managed to add some cljs
code to the project using a simple config like this from the README:
{:source-paths ["src/cljs"]
:builds {:code
{:target :npm-module
:output-dir "node_modules/shadow-cljs"
:entries [foo]}}}
Seems to work great, I can use it from the js code and it works. Yay!!
I'd now like to make it run seamlessly for everyone using the project (they only use JS).
For me, seamlessly would imply no one else has to run anything else than npm ci
, npm test
and npm start
The two options I'm looking at are:
• a separate project that would produce a separate npm module and importing that
• hacking it into some sort of public/js
build folder and checking in the compiled js files
Is there a recommended way to do this?a npm module seems best? assuming the JS people are always going to run webpack anyways?
Yeah I'm leaning towards that. A main purpose of having cljs at all is to share some functions between the frontend and backend (and getting to implement them in Clojure!). I wonder if I could somehow add this to our build from the backend modules and just output an npm module? :thinking_face:
Yep! It's semantically a structure like:
monorepo/
backend1/
backend2/
common-stuff/
ui/
ui
is a webpack project, and common-stuff
is a clojure project used by both backends.
The idea would be to have parts of that be also accessible to the ui
project.