This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-08
Channels
- # announcements (22)
- # aws (4)
- # babashka (25)
- # beginners (78)
- # calva (9)
- # cider (22)
- # cljdoc (2)
- # cljsrn (2)
- # clojure (27)
- # clojure-australia (7)
- # clojure-europe (22)
- # clojure-nl (15)
- # clojure-uk (26)
- # clojurescript (20)
- # datahike (3)
- # datomic (15)
- # events (1)
- # helix (5)
- # honeysql (4)
- # kaocha (1)
- # malli (1)
- # meander (1)
- # off-topic (84)
- # pathom (14)
- # re-frame (3)
- # reagent (28)
- # reitit (6)
- # sci (1)
- # shadow-cljs (78)
- # tools-deps (30)
When I use "watch" I get no warnings. But with release, I get the following warning. I guess it should be reorted to cognitect:
------ WARNING #1 - ----------------------------------------------------------- Resource: com/cognitect/transit.js:649:8 variable module is undeclared --------------------------------------------------------------------------------
(defn render-math [dom-node data-js] (let [mathjax (.-MathJax js/window) ;options (clj->js options) options (.getMetricsFor mathjax dom-node true)] (-> (.tex2svgPromise mathjax data-js options) ; (.then (fn [math-node] (.appendChild dom-node math-node) #_(add-math-css)))))) (defn ^{:category :ui} math "displays mathematical formulas" [{:keys [data options]}] [render-js {:f render-math :data data}])
do you not get an externs inference warning? or are you on an old version that didn't have that enabled by default yet?
I am not getting an externs inference warning. In adanced compilation the js module functions disappear. I will investigate more when this happens.
please describe how you determined that it "disappeared". Closure doesn't just delete code.
I have a dependency .jar that uses shadow-cljs for it’s dependency management, does that project need to also include a deps.edn with mirrored dependencies so the parent project fetches them?
or mirror them in the project.clj, I’m not sure how nested dependency management works
I’m trying to run jest with shadow cljs, and this is my test config:
{:target :browser-test
:test-dir "target/test/"
:autorun tr
which basically compiles to target/test/js/test.js, but when I run jest on test.js, it produces the following:
FAIL target/test/js/test.js
● Test suite failed to run
browser bootstrap used in incorrect target
1449 |
1450 | if (!doc) {
> 1451 | throw new Error("browser bootstrap used in incorrect target");
| ^
1452 | }
1453 |
1454 | var scriptBase = goog.global.window.location.origin;
at Object.call (target/test/js/test.js:1451:11)
at Object.<anonymous> (target/test/js/test.js:1582:3)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.43 s
How to fix this?
This is the singular test file that’s being compiled:
(ns humboi.sum-test)
(defn sum [a b] (+ a b))
(test "adds 1 + 2 to equal 3"
(fn []
(.toBe (expect (sum 1 2)) 3)))
so what would be the correct target type?
I have npm installed @testing-library/react, but I’m still getting the following: https://gist.github.com/zendevil/0f88020fa4c757f1fc3b664425c51a6d I have tried deleting node_modules
that is a node error. node cannot find that module. did you install it in the correct directory?
what I meant was that I tried deleting node_modules and running npm install
I ran npm install --save-dev @testing-library/react in the root of the project
On browser-test target, a similar error:
[:test] Compiling ...
[:test] Build failure:
The required JS dependency "@testing-library/react" is not available, it was required by "humboi/core_test.cljs".
Dependency Trace:
humboi/core_test.cljs
Searched for npm packages in:
/Users/prikshetsharma/Desktop/humboi/node_modules
See:
well does it exist? there should be a /Users/prikshetsharma/Desktop/humboi/node_modules/@testing-library/react
directory?
it doesn’t exist (even after npm install) but does in the devDependencies in package.json
removing from devDependencies and installing with --save works
without manually removing from devDependencies, --save has no effect
btw in a luminus app, lein test
runs only the clj tests. Is there a way to run only the cljs tests?
in any project that has both clj and cljs tests, how does one run only the cljs tests?
and what if the target is browser-test?
the port specified in :devtools {:http-port isn’t connecting when opened in the browser
does that mean that I have to spin another server on that port?
no, you don't need to start a separate server. assuming the config is correct it should be running.
yeah the test watch is already running
{:nrepl {:port 7002}
:builds
{:app
{:target :browser
:output-dir "target/cljsbuild/public/js"
:asset-path "/js"
:modules {:app {:entries []}}
:devtools {:watch-dir "resources/public"
:preloads [re-frisk.preload]}
:dev {:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}}
:release {}}
:test {:target :browser-test
:test-dir "target/test/"
:autorun true
:devtools {:http-port 8081
:http-root "target/test/"}}}
:lein true}
both watches are running
and test is compiling without warnings
looks fine but FWIW you should be using :dev-http
https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http
http://localhost:8081 should be working
8081 isn’t working
can’t be reached
I start it with cider
It does give this error:
Execution error (AssertionError) at shadow.cljs.devtools.server.nrepl/shadow-cljs-repl (nrepl.clj:30).
Assert failed: (keyword? repl-env)
in the very beginning
hello, I'm trying to include a recent version of BlueprintJS (https://blueprintjs.com/docs) in a project, but seems like Shadow can't load the files there
my first guess is because the code has Typescript in it
but it also has a dist compiled version like "@blueprintjs/core/dist/core.bundle.js"
, I tried to load that but no luck
is there a way to load this kindle of bundles with Shadow?
when I try to load ["@blueprintjs/core" :as bp-core]
, it doesn't give any error, but the bp-core
comes blank
same when trying to require the bundled
I tried reverting to a blueprint version I now worked before, but that seems broken now too, gonna try to find in which version of shadow it broke
that's strange, I reverted the version of shadow and blueprint to ones I know that work in another project, but I'm still getting the same errors
nevermind, the issue is completly something else, I'm loadingf require.js
to load monaco and that was conflicting under window.require
I'm trying to integrate Monaco editor (https://microsoft.github.io/monaco-editor), but loading it is a pain... just from shadow it doesn't load at all, and this AMD approach is conflicting with the shadow loader stuff
would love to hear if anyone has a way around this
We’ve dealt with something similar to this, our solution was making sure require came after loading the main.js (I think, it’s been a little while)
Although all our usage of the thing needing require was done through the
using interop, rather than importing it in shadow
thanks, I ended up doing the same, and loading requirejs itself via react hooks inside the component