This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-22
Channels
- # announcements (16)
- # babashka (7)
- # babashka-sci-dev (14)
- # beginners (34)
- # calva (80)
- # clj-kondo (23)
- # cljdoc (17)
- # cljs-dev (1)
- # cljsrn (10)
- # clojure (51)
- # clojure-berlin (3)
- # clojure-europe (14)
- # clojure-italy (10)
- # clojure-nl (2)
- # clojure-norway (211)
- # clojure-uk (5)
- # clojurescript (4)
- # cursive (22)
- # datalevin (12)
- # datomic (2)
- # defnpodcast (1)
- # duct (5)
- # emacs (4)
- # events (2)
- # fulcro (3)
- # graalvm (1)
- # interop (3)
- # introduce-yourself (4)
- # java (1)
- # jobs (7)
- # kaocha (38)
- # leiningen (3)
- # lsp (11)
- # malli (4)
- # membrane (5)
- # music (1)
- # off-topic (28)
- # pathom (13)
- # pedestal (3)
- # polylith (4)
- # portal (10)
- # practicalli (1)
- # re-frame (33)
- # reitit (2)
- # remote-jobs (1)
- # sci (6)
- # shadow-cljs (49)
- # sql (4)
- # xtdb (3)
@thheller Right, thanks. I was just surprised that this was such an uncommon problem in the Node CLJS world. But I realized just now that we are probably requiring JS libraries that are mostly used in the browser, and that’s the bit that is uncommon.
you can use :target :esm
to generate ESM output which can consume those libs just fine
When upgrading to latest shadow (from http://2.15.in a project, I get:
Syntax error compiling at (shadow/build/cljs_hacks.cljc:101:27).
No such var: ana/munge-goog-module-lib
What could be the culprit here? Even trying with 2.16.4 I get the same error.A too old ClojureScript seems to have been the problem. This was then obscured by some of our sub projects depending on old versions of shadow-cljs. When I comment away those transitive deps, shadow suggested the ClojureScript dependency as a source of the problem. Which it was.
Now, I somehow suspect that the problem I was chasing (a lot of cider-nrepl ops unavailable) could have been caused by the transitive shadow-cljs dependencies. What's the recommended setup there? We have a lot of sub projects where we use shadow-cljs. Would excluding shadow-cljs when declaring the subproject dependencies in the main project help?
the main project needs to declare its shadow-cljs dependency. that is pretty much the only thing you need.
just need to avoid the situation where you only have shadow-cljs declared but not clojurescript
that way it can pick the new shadow-cljs but some old clojurescript somewhere out of the transitive deps if it doesn't find the one declared by shadow-cljs "first"
The main project is declaring its shadow-cljs dependency. Yet had a situation when a version from some sub project was used. Probably a misconfiguration, right?
With the original config it behaves like you say, main project wins. It was while fiddling around trying to understand that compile error that all of a sudden I saw yet another shadow version being used.
hard to comment without knowing your particular setup. you can make pretty much everything happen if you want 😛
I am having trouble getting cljs-devtools loading on a :target npm-module
build. I tried different flavors of manual install, but nothing working. Any tips?
{:source-paths ["src"]
:dependencies
[[binaryage/devtools "1.0.5"]]
:builds
{:code
{:target :npm-module
:output-dir "node_modules/shadow-cljs"
:entries [gbo.mycljs]}}}
(ns gbo.mycljs
(:require [devtools.core :as devtools])
(defn installCljsDevtools []
(devtools/install!))
app.js
var clj = require("shadow-cljs/gbo.mycljs");
clj.installCljsDevtools();
I tried calling the devtools/install!
from the html in a different script tag, but was unable to call it as a second namespace, exposed in the global html context.
The resulting js is run through (an older) webpack build, could that be the issue?
My dev server has to run on node 12.6.
But i compile shadow-cljs with latest node, and other functions seem to run ok.I reset my devtools to defualts, and now something is showing up.
I am getting this even if I try to run with :optimizations :none
:builds
{:code
{:target :npm-module
:output-dir "node_modules/shadow-cljs"
:entries [gbo.mycljs]
:compiler-options {:optimizations :whitespace}}}
Maybe I need an explict :devtools
config with things like
:watch-dir
:watch-path
:before-load-async
:after-load
I am not using the shadow-cljs server. I am running of a webpack build/reload codepase and using :npm-module
to integrate cljs. But i am open to other suggestions. (Like is it easier to just use another build target?) I prefer to not disrupt the existing js codebase, just add some functions to it.
you don't need any additional config for cljs-devtools but its kinda hard to tell what might be wrong without seeing the JS side of things
I am not sure if this question should go here or clojurescript but oh well. I have code like this
(fn [row-data]
(. row-data -field))
And this function something on dev build but returns undefined in the release build. My guess is there is something going on in the optimization (obviously). I am curious why it breaks and how to make sure that it works consistently?you really should be getting a warning for this. unless you are on a really really old shadow-cljs version, or decided to ignore the warnings or turn them off 😛
Oh, right, thanks!
interesting why I’m not getting a warning :thinking_face:
which shadow-cljs version do you use? in older versions this wasn't enabled be default
thheller/shadow-cljs {:mvn/version "2.9.10"}
I will consider updating then 🙂 Thank you
just checking something ... I'm trying to load my app using shadow and tools.deps - but I only seem to ever get the dashboard
I read that clj
does not support server-mode
- so does that mean that I can't have the app served by shadow in this configuration?
uhm the dashboard is served on its own server that has nothing to do with your apps code. that is a separate thing.
the dashboard runs on :9630 by default. for your app you can use :dev-http
or any other webserver you want. https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http
I have symlinked my node_modules directory somewhere outside my project (so that i can cache between runs in CI) and whilst npm is fine with this, shadow-cljs appears unhappy. I get
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'readline-sync'
is that a known issue?