This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-25
Channels
- # beginners (26)
- # boot (1)
- # cider (21)
- # cljdoc (26)
- # cljs-dev (7)
- # clojure (99)
- # clojure-gamedev (6)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-russia (1)
- # clojure-spec (5)
- # clojure-uk (59)
- # clojurescript (49)
- # clojutre (6)
- # component (13)
- # core-async (2)
- # cursive (30)
- # data-science (2)
- # datomic (29)
- # emacs (9)
- # fulcro (100)
- # hyperfiddle (1)
- # jobs (2)
- # luminus (4)
- # lumo (23)
- # off-topic (22)
- # other-languages (37)
- # parinfer (1)
- # re-frame (2)
- # reagent (5)
- # reitit (12)
- # ring (12)
- # rum (3)
- # shadow-cljs (168)
- # slack-help (1)
- # spacemacs (7)
- # specter (2)
- # tools-deps (8)
- # vim (11)
- # yada (3)
What is the purpose of the socket REPL that's being also started? Is it currently used, or is it there in preparation for future use? I couldn't find anything in the guide, and I'm curious 🙂
@samuel.wagen you are free to use it. I sometimes use it when I get frustrated by some nrepl stuff.
@samuel.wagen shadow-cljs clj-repl
uses the socket REPL. then (shadow/browser-repl)
switches it to a CLJS browser repl. or (shadow/node-repl)
or (shadow/repl :your-build)
oh of course. clj-repl does an implicit require. if I do (require '[shadow.cljs.devtools.api :as shadow])
then (shadow/repl :build-id)
works and I get the cljs repl
(ns shadow.user
(:require
[clojure.repl :refer (source apropos dir pst doc find-doc)]
[clojure.java.javadoc :refer (javadoc)]
[clojure.pprint :refer (pp pprint)]
[shadow.cljs.devtools.api :as shadow :refer (help)]))
yep, doing (in-ns 'shadow.user)
and (shadow/repl :build-id)
does the trick with unravel
> Cursive does not currently support resolving dependencies via shadow-cljs.edn. You can run shadow-cljs pom to generate a pom.xml and import that using the IntelliJ.
How exactly?
Curisve still doesn’t recognise detest
@kwladyka you call shadow-cljs pom
and then in cursive file -> new -> project from existing sources and select the pom.xml
oh in that way. It doesn’t sound like good solution considering dependencies changing, so each time I will have to start new project.
just call shadow-cljs pom again and cursive will automatically update the changed pom.xml
ah .. nvm its not pretty printed so its tough to tell if it actually contains something
then I don't know. can you post the pom.xml
so I can look at it? just tested it on a dummy project and it worked fine.
haha it is funny, but:
> @kwladyka you call shadow-cljs pom
and then in cursive file -> new -> project from existing sources and select the pom.xml
I was selecting pom.xml
file.
As I see right way is to choose directory contain pom.xml
file, not select file directly.
yes, but it is deeper issue. It is not indent correctly, because Cursive doesn’t see this dependency.
normally I can press cmd+down and it will open source code of deftest. With shadow-cljs I can’t so my assumption Cursive can’t find that dependency
But I opened this project by select directory, not pom.xml
. It doesn’t work for me as I mentioned before.
I don't know what to tell you. I click new -> project -> project from existing sources
then select the actual generated pom.xml
file. accept a couple times and nothing else
it works fine with the file you just posted and creating the test/boilerplate/example_test.cljs
When you select folder instead of a file does it work the same for you or there is a difference?
you can try cloning this repo https://github.com/shadow-cljs/quickstart-browser and trying it there
I thought the maven integration was built-in but maybe its a plugin? or disabled for some reason?
I went to the plugin list and checked maven integration
, restart Intellij and it works
@kwladyka if you can, another good option is to use deps.edn
to manage dependencies, Cursive is supporting those already in the latest versions
@wilkerlucio It is important to point out that there are some caveats and that support is alpha quality AFAIK
FWIW pom.xml
is the most stable and well supported option and we really only need to tell cursive about the deps and source paths
when I run in dev mode, everything works as expected. however when I do a release build, I get an error when the bundle runs
this is my shadow-cljs.edn config for this build:
:dashboard
{:target :browser
;; :module-loader true
:modules
{:main {:entries [cambia.web.experience.dashboard.client.core]}
:icon-row {:entries [cambia.web.experience.dashboard.components.icon-row.client]
:depends-on #{:main}}
}
:compiler-options {:infer-externs :auto}
:output-dir "public/dashboard/assets/app/js"
:asset-path "assets/app/js/"
:devtools
{:after-load cambia.web.experience.dashboard.client.core/start-dev}}
@lilactown add :compiler-options {:infer-externs :auto}
only one in a completely unrelated file:
[:dashboard] Compiling ...
------ WARNING #1 --------------------------------------------------------------
File: cambia/web/experience/dashboard/components/hsa/client.cljs:3:10
variable $ is undeclared
--------------------------------------------------------------------------------
nil
try running with shadow-cljs release dashboard --pseudo-names
and do whatever to trigger the error
you can try adding :compiler-options {:output-wrapper true}
or find out how the global P
is defined and what it is
:output-wrapper
isn't great when using modules so you should rather find out where that clashing global is coming from
not really complaining but I did notice that going from 2.3.x => 2.4.24 that my release bundle got bigger by about 4x (224kb to 804kb)
do you have the P defined in the page when you remove the script tag for your JS code?
or asked another way: are there any other script tags in the page besides your CLJS code?
generate a build report and see where all the bytes come from: https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report
yeah nevermind that. its a confusing error since closure thinks it created the P
variable and points you to the location where it created it
:output-wrapper
guards you against such things but makes the build larger by 5% or so
could be one of the polyfills or analytics scripts that I have to use :face_with_rolling_eyes:
I'm okay with a 5% increase if I (or my team, who has no idea how to debug this stuff :P) don't need to worry about this
well you know thats its P
so the simple fix is to create externs/dashboard.txt
with one line global:P
and done
but yeah :output-wrapper
is generally safer. you can always optimize that away later.
I don't see anything super offensive - it looks like clojure.core is the largest offender
on the 2.3 branch I'm seeing about the same when I run the release build locally - 800kb
I was comparing it to the bundle I currently have deployed - I wonder why there's such a difference
What is the best way to use cljs REPL
with shadow-cljs
with cursive
? https://github.com/thheller/shadow-cljs/wiki/Cursive#connecting-to-a-shadow-repl ?
@thheller I wanted to investigate a bit how to add REPL support for :node-test
and I see that you are disabling :devtools
explicitly?
is it because of stable namespaces are needed there and we don't have one? (I actually though we always have a main entry point autogenerated)
I could use the normal :node-script
target with a REPL but I don't know if the tests are compiled there