This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-13
Channels
- # babashka (7)
- # babashka-sci-dev (3)
- # beginners (29)
- # biff (16)
- # calva (2)
- # clojars (1)
- # clojure (50)
- # clojure-austin (5)
- # clojure-europe (29)
- # clojure-france (8)
- # clojure-nl (3)
- # clojure-uk (3)
- # clojured (10)
- # clojurescript (19)
- # code-reviews (3)
- # core-async (22)
- # cursive (5)
- # data-science (11)
- # datalevin (1)
- # datomic (10)
- # eastwood (4)
- # helix (4)
- # introduce-yourself (2)
- # jobs (1)
- # jobs-discuss (1)
- # joyride (6)
- # leiningen (4)
- # london-clojurians (2)
- # lsp (82)
- # malli (7)
- # meander (12)
- # minecraft (3)
- # nbb (14)
- # off-topic (52)
- # podcasts (3)
- # portal (3)
- # re-frame (32)
- # reagent (9)
- # releases (2)
- # shadow-cljs (95)
- # tools-deps (14)
.../dist/cljs_env.js:748
return evalCheck('let r;try{r\x3d", "}catch{};r'););
^
SyntaxError: Unexpected token ')'
> 1 | var $CLJS = require("./cljs_env");
| ^
2 | var $jscomp = $CLJS.$jscomp;
3 | var COMPILED = false;
4 | require("./cljs.core.js");
at Runtime.createScriptFromCode (../../node_modules/.pnpm/[email protected]/node_modules/jest-runtime/build/index.js:1728:14)
at Object.<anonymous> (.../dist/mn.flow.ibanxs_data.js:1:13)
disclaimer: omitted some of the sensible dirs
when trying to run a compiled cljs with :target :npm-module
on jest, I get this
the same thing happens if run with :target :node-library
oh, and it works with node
Welcome to Node.js v14.19.3.
Type ".help" for more information.
> const { typeSchemas, validate, explain } = require('./dist/mn.flow.ibanxs_data.js')
undefined
> validate(typeSchemas.Country, { id: "BR", name: "Brazil" })
true
> validate(typeSchemas.Country, { id: "BR", name: 123 })
false
found it!
not really related to shadow-cljs, but with jest
needed to use transformIgnorePatterns
option on jest's config to ignore compiled cljs files
when trying to run a compiled cljs with :target :npm-module
on jest, I get this
needed to use transformIgnorePatterns
option on jest's config to ignore compiled cljs files
when attempting to load two different :npm-module
s in the same js file, I get this
Namespace "goog.debug.Error" already declared.
107 | if (!COMPILED) {
108 | if (goog.isProvided_(name)) {
> 109 | throw new Error('Namespace "' + name + '" already declared.');
| ^
110 | }
111 | delete goog.implicitNamespaces_[name];
112 | }
it seems that runtime dependencies to run cljs is getting loaded twice
they are two different "libraries"
defined in two different shadow-cljs.edn
the idea would be to have reusable npm-like libraries
that could be required as needed
do you know what I mean?
each library will have its own cljs.core variant and they will not be compatible with each other
I thought about it
is there a way to have cljs runtime dependencies loaded just once?
and btw, does this limits me to only being able to use monolith cljs libraries with node?
you can have ONE build that includes the whole universe of CLJS libraries. all of them for all I care.
the trouble only starts when you want to build pre-compiled libraries to be included in JS separately
let me see if I understood
having multiple cljs libs defined each with their own shadow-cljs.edn
is a bad idea?
not feasible?
I'm trying to integrate cljs in js
legacy ts code that is
we work with multiple packages
each package acting as its own standalone lib
> so you have two separate CLJS libraries
ok, right
but what if they those other 2 libs are defined in separate shadow-cljs.edn?
this third lib must have access to the cljs source of the original 2 libs, right?
I think I got it now
does deps.edn play well with shadow-cljs?
just manages dependencies. does not affect compilation in any way if you use deps.edn or project.clj or just shadow-cljs.edn
thanks a lot!
hey @U05224H0W, just confirm, if I'm using deps to manage my dependencies, do I have to use clj
to compile or it still works running shadow-cljs
?
also, server doesn't work with deps, right?
you literally only move the :dependencies
and :source-paths
from shadow-cljs.edn
to deps.edn (with :deps
and :paths
there) and add the thheller/shadow-cljs
dependency which is automatically included in shadow-cljs.edn but not in deps.edn
> you literally only move I understood that
just wasn't sure if server worked
with deps
again. it is just managing dependencies. the shadow-cljs
CLI tool continues with the same functionality and nothing else changes
shadow-cljs start
when :deps true
I only use shadow-cljs server
. ie. start but keep running in foreground rather than background
shadow-cljs - config: .../shadow-cljs.edn
shadow-cljs - starting via "clojure"
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.
after running shadow-cljs start
even though I added shadow-cljs as :extra-deps