This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-05
Channels
- # aleph (1)
- # announcements (18)
- # babashka (145)
- # beginners (70)
- # calva (34)
- # cider (3)
- # clj-kondo (98)
- # cljdoc (5)
- # cljs-dev (13)
- # clojure (134)
- # clojure-europe (57)
- # clojure-nl (4)
- # clojure-uk (4)
- # clojurescript (40)
- # code-reviews (3)
- # conjure (1)
- # core-async (5)
- # data-science (3)
- # datomic (8)
- # fulcro (9)
- # google-cloud (2)
- # inf-clojure (9)
- # jobs (1)
- # lsp (9)
- # malli (25)
- # polylith (4)
- # reitit (4)
- # releases (2)
- # remote-jobs (3)
- # rewrite-clj (8)
- # shadow-cljs (34)
- # tools-build (1)
- # tools-deps (67)
I am trying to figure out why a dependency did not get pulled into a shadow build. I am weak on CLJS builds I will confess. FWIW, I started from the coolio Helix todo-mvc project: https://github.com/lilactown/helix-todo-mvc,
That just does npm i
and npm start
to get things running:
{
"private": true,
"scripts": {
"start": "npx shadow-cljs watch app" <=====================
},
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-refresh": "^0.8.1",
"react-router-dom": "^5.1.2",
"react-slider": "^1.3.1",
"shadow-cljs": "^2.8.94",
"todomvc-app-css": "^2.4.1",
"todomvc-common": "^1.0.5"
}
}
My deps.edn is
{:paths ["src" "src/demo" "src/mxreact"]
:deps {lilactown/helix {:mvn/version "0.1.1"}
binaryage/devtools {:mvn/version "0.9.7"}
thheller/shadow-cljs {:mvn/version "2.15.1"}
tiltontec/matrix {:mvn/version "4.1.7-SNAPSHOT"}
cljs-http/cljs-http {:mvn/version "0.1.46"}}}
The dependency not retrieved by the build is Matrix.
The build then complains about a Matrix namespace not being found. Inspection of .m2
confirms the deficit.
If I execute clojure -P
the dependency is pulled from Clojars and the build succeeds. Yay.
My shadow-cljs.edn is :
;; shadow-cljs configuration
{:deps true
:builds
{:app {:target :browser
:output-dir "js"
:asset-path "/js"
:modules {:app {:entries [app.core]}}
:devtools {:http-root "."
:http-port 8888
:reload-strategy :full
:preloads [devtools.preload
demo.dev]}}}}
My app.core
NS is:
(ns app.core
(:require
[tiltontec.model.core :as md]
[react]
[mxreact.mxreact :as mxr]
["react-dom" :as rdom]
[demo.demo :as dmo]
["react-slider" :default ReactSlider]
[tutorial.x100-hello-world.lesson :as app]
))
Can anyone see why clojure -P
was needed to get the dependency downloaded? Or is that just part of the drill when new dependencies are added?
Thx! 🙏@hiskennyness shadow-cljs does not control what clojure
does. if you set :deps true
when running shadow-cljs watch app
it will call clojure -M -m shadow.cljs.devtools.cli watch app
and let clojure
handle all dependency resolution and classpath creation. shadow-cljs
will not attempt to download anything itself in that case. I do not know why it may not download something. In general I'd stay very far away from SNAPSHOT
dependencies and instead use :local/root
or :git/url
if you can
did you maybe not restart shadow-cljs after adding the dependency? modifying deps.edn
does require a shadow-cljs restart. just leaving the watch running won't work.
Good morning folks, I'm looking to set up a workflow where i have a shadow-cljs build running on a remote server and I connect to it from my local Emacs + Cider. Has anyone tried this?
hello đź‘‹ I'm getting this error while trying to import an npm package
shared.js:1552 TypeError: Super expression must either be null or a function, not undefined
at eval (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:35)
at eval (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:35)
at Object.eval (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:44)
at r (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:2)
at Object.eval (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:32)
at r (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:2)
at eval (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:4)
at eval (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:4)
at eval (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:1)
at Object.shadow$provide.module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min (module$node_modules$react_leaflet_vectorgrid$dist$react_leaflet_vectorgrid_min.js:2)
Here's how the import statement looks like
["react-leaflet-vectorgrid" :default VectorGrid]
here's how it's imported in JS `
import VectorGrid from 'react-leaflet-vectorgrid';
https://www.npmjs.com/package/react-leaflet-vectorgridsorry. dunno never seen that error before. might be something to do with transpilation/polyfills
Hello. How do I access a custom value provided in :compiler-options
inside of (defmacro ...)
? Say, I have {:compiler-options {:xyz "23"}}
. What is the path to "23"
in &env
?
see https://github.com/binaryage/cljs-devtools/blob/master/src/lib/devtools/prefs.clj#L8-L12
No, @thheller, I did not have a watch running. The npm start
command indirectly starts a watch, but I control-c'ed it each time, once it announced the missing dependency.
Yes, I have :deps true
in my shadow-cljs.edn,
I am surprised to hear SNAPSHOT is a bad idea. Is that not a standard part of the ecosystem? I have noticed they do not work as dynamically as is really needed for iterative devlopment.This could be a breakthru! 🙂
I never heard of :local/root
or :git/url
options. To what are those options? I'll look around.
I will also see what the clojure CLI crew has to say about dependency resolution.
Thx!
note that running npm start
does not imply that there is not a previous running server
Yeah, I am always careful to run just one (and check there is just one if things seem broken). Thank god for terminal (on OS X anyway) putting a bullet next to any terminals with a running process.
I am getting a "required namespace is not available error" when starting up shadow-cljs. I created a project with a hyphen in it's name but then my main function is contact-book.core/main
which I can't call in my index.html script because js does not allow hyphens. Am I understanding that correctly? Wherever my main function is should not have a hyphenated namespace or am I doing something else wrong?
define "required namespace is not available error". if you follow the rules everything should be fine. see https://code.thheller.com/blog/shadow-cljs/2021/05/13/paths-paths-paths.html
Can 'dev-http' start up an https server? https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http seems to imply that it is, but when I try
:dev-http {8081 "resources/public"
8444 {:root "resources/public"
:ssl true}}
I just get two http endpoints
I would expect to have to supply a jks keystore too...I would like a dev https server to get my head around some secure cookie stuff
:dev-http {8081 {:root "resources/public"
:ssl-port 8444
:ssl true}}
doesn't seem to work eitherI am running
npx shadow-cljs watch foo
perhaps watch
is not leveraging dev-http...?it looks like you're missing the :ssl
config in the top level? https://shadow-cljs.github.io/docs/UsersGuide.html#_ssl