This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-06
Channels
- # announcements (5)
- # asami (4)
- # babashka (27)
- # beginners (1)
- # calva (4)
- # cider (64)
- # clj-kondo (7)
- # clojure (7)
- # clojure-brasil (3)
- # clojure-europe (41)
- # clojure-france (2)
- # clojure-norway (101)
- # clojure-uk (5)
- # clojurescript (19)
- # cursive (3)
- # datahike (15)
- # datomic (15)
- # events (2)
- # honeysql (11)
- # hyperfiddle (27)
- # introduce-yourself (2)
- # jobs-rus (1)
- # leiningen (8)
- # london-clojurians (1)
- # lsp (175)
- # off-topic (52)
- # overtone (10)
- # portal (15)
- # re-frame (7)
- # reagent (1)
- # releases (1)
- # remote-jobs (2)
- # shadow-cljs (15)
- # sql (5)
Can I require
an edn
file like I can import a JSON in JS?
I'm running in the browser using shadow-cljs
Maybe inline it with shadow.resource/inline
.
(:require [shadow.resource :as rc])
(read-string (rc/inline "myfile.edn"))
Where myfile.edn
is inside src
or elsewhere in classpath.(def x (rc/inline "./app.edn"))
--------------^-----------------------------------------------------------------
Encountered error when macroexpanding shadow.resource/inline.
Could not resolve ./app.edn from main at line 13 main.cljs
Both main.cljs
and app.edn
are in src
could be that it doesn't like non segmented namespaces. your namespaces should have proper structure
the logic could be broken for making things relative to the root. not really sure, single segment namespaces are not recommended
Hi, trying to compile cljs project with ShadowCljs (JVM v2.17.8) ends up with
[2023-11-06 20:00:06.888 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:type :start-autobuild}}
NoSuchFieldError ECMASCRIPT_NEXT_IN
shadow.build.closure/lang-key->lang-mode (closure.clj:80)
shadow.build.closure/lang-key->lang-mode (closure.clj:79)
shadow.build.closure/set-options (closure.clj:144)
shadow.build.closure/set-options (closure.clj:111)
shadow.build.closure/convert-goog* (closure.clj:2262)
shadow.build.closure/convert-goog* (closure.clj:2227)
shadow.build.closure/convert-goog (closure.clj:2406)
shadow.build.closure/convert-goog (closure.clj:2356)
shadow.build.compiler/maybe-closure-convert (compiler.clj:1218)
shadow.build.compiler/maybe-closure-convert (compiler.clj:1211)
shadow.build.compiler/compile-all (compiler.clj:1453)
shadow.build.compiler/compile-all (compiler.clj:1330)
The thing is the same project works on my workmates machines. I even made a new (Linux) account and cloned repo to test it there and it works. I removed almost all the stuff from ~/.clojure/deps.edn
so it looks like this, but still the same:
{:deps {org.clojure/clojure {:mvn/version "1.11.1"}
org.clojure/clojurescript {:mvn/version "1.11.121"}}
:aliases {:nrepl {:extra-deps
{nrepl/nrepl {:mvn/version "1.1.0"}
cider/cider-nrepl {:mvn/version "0.43.0"}
com.kohlschutter.junixsocket/junixsocket-core {:mvn/version "2.3.2"}}
:main-opts ["-m" "nrepl.cmdline"
"--middleware" "[cider.nrepl/cider-middleware]"]}
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.9.4" :git/sha "76b78fe"}}
:ns-default build}}}
Also I upgraded all versions. Does anyone have any idea what can cause this problem?Probably a transitive dependency of your project and one of shadow-cljs are overlapping in an incompatible way. It's pretty common for the Google Closure dep. Although that doesn't explain why your workmates don't see the same :thinking_face:
Ok. We had no clojurescript dep in project's deps.edn so shadow was trying to use my global cljs 1.11.x. I just added the latest 1.10.x to deps and it works fine. My workmates probably had installed 1.10 so this is why it worked for them. Thank you for help