This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-08
Channels
- # bangalore-clj (4)
- # beginners (88)
- # boot (12)
- # cljs-dev (10)
- # cljsjs (1)
- # clojure (284)
- # clojure-denmark (2)
- # clojure-dev (35)
- # clojure-italy (8)
- # clojure-russia (36)
- # clojure-spec (38)
- # clojure-uk (51)
- # clojurescript (145)
- # cursive (6)
- # data-science (1)
- # datomic (8)
- # duct (43)
- # emacs (9)
- # figwheel (2)
- # fulcro (29)
- # graphql (1)
- # immutant (3)
- # instaparse (1)
- # jobs (1)
- # jobs-discuss (1)
- # lumo (16)
- # off-topic (50)
- # onyx (90)
- # re-frame (6)
- # reagent (20)
- # remote-jobs (3)
- # ring-swagger (18)
- # schema (8)
- # shadow-cljs (141)
- # slack-help (3)
- # spacemacs (36)
- # unrepl (7)
- # vim (1)
- # yada (2)
I don't think dynamic import is a perfect solution either. Just sometimes sites go too large, no other solutions left.
@jiyinyiyong I thing :modules
and shadow.loader
are pretty good solutions for this but ultimately it is up to the developer of each app
if your app requires 3mb JS to even run you are doing it wrong. splitting it into smaller parts that then get loaded “dynamically” but still all need to be loaded for your app to work is basically the same as loading everything at once.
in my experience the best optimization is using <script src="..." async>
or defer
. together with <link rel="preload">
(or h2
push) to let the browser start the download early.
I’m getting this build error when evaluating things in a cljs REPL, and then saving the same file:
[:browser] Build failure:
symbol re-view.hiccup.core already provided by [:shadow.build.classpath/resource "re_view/hiccup/core.cljs"], conflict with [:shadow.cljs.repl/resource re-view.hiccup.core]
{:provide re-view.hiccup.core, :conflict [:shadow.build.classpath/resource "re_view/hiccup/core.cljs"], :resource-id [:shadow.cljs.repl/resource re-view.hiccup.core]}
ExceptionInfo: symbol re-view.hiccup.core already provided by [:shadow.build.classpath/resource "re_view/hiccup/core.cljs"], conflict with [:shadow.cljs.repl/resource re-view.hiccup.core]
so first loading (ns re-view.hiccup.core)
via REPL, than saving the file and watch
loading it again?
in the REPL I usually want to be in control of what gets loaded, the live-reload just gets in the way at that point
I am finding out that if I change my entry point that I don't get the pprint error. I am suspecting fulcro to be the problem then
I am just trying out namespaces untill it breaks ^^
I love how fast the npm version is of shadow-cljs
its even faster if you leave a shadow-cljs server
running somewhere. only need to restart that if you change dependencies currently.
Oh nice, but I will still put it into leiningen probably
you can do this https://github.com/thheller/shadow-cljs/blob/master/shadow-cljs.edn#L1-L2
Yeah already found it
We should work on a good shadow-cljs website, do you need any help? I fixed the fulcro website a few weeks ago
I might take a stab at it this project deserves more attention
Writing docs is extremely hard
But I have it working now if I first compile a different NS and then the one I want
That is not something I like hmm
if uses https://clojars.org/clojure-future-spec and that should be excluded since we are on clojure 1.9 anyways
Ok I excluded this, I think we are on the correct clojure version since I am using the npm version
[fulcro.client.core :as core]
This is the complete NS btw:
(ns atlas-crm.ui.entry-points.spa-main
(:require [atlas-crm.ui.entry-points.spa :refer [app]]
[fulcro.client.core :as core]
[atlas-crm.ui.root :as root]))
(reset! app (core/mount @app root/Root "app"))
If try to compile the atlas-crm.ui.entry-points.spa
that also fails so that might be the problem
The required namespace “yahoo.intl-messageformat-with-locales” is not available, it was required by “fulcro/i18n.cljc”.
Yeah i fixed that
(ns yahoo.intl-messageformat-with-locales
(:require ["intl-messageformat" :as intl-messageformat-with-locales]
[goog.object :as gobj]))
(gobj/set js/window "IntlMessageFormat" intl-messageformat-with-locales)
If you want I can try to make a minimal reproduction
So I am not wasting your time
but I kinda want to go through the process myself to see what people need to do to get this running
Ah ok, I'll be back in about 30 minutes
https://github.com/thheller/shadow-cljs/commit/f28191f9ab3a9158553c36a96c15e8bba6590435 those are the things I added to make it work
mostly the cljsjs.react
and cljsjs.react.dom
helpers since om
is stil using js/React.createClass
and js/React.DOM.h1
etc
14sec to compile om.next
.. wonder what crazy things that ns is doing … scared to look 😛
(:require [clojure.pprint :refer (pprint)])
causes it … thats what you get when trying to take a shortcut in the alias code 😛
when working with the REPL, should watch
become “passive”? as in not reload files automatically?
it is currently possible to start dev worker in passive mode by calling (shadow/watch :your-build {:autobuild false})
I guess I have only done the REPL-first development when using shadow-cljs node-repl
hmm. related question, when I try the ‘Load file in REPL’ command in cursive, it says “TBD” and I think i have to restart the repl. do you know if this is expected, and if it is on the cursive or shadow-repl side?
for me i’m usually not thinking in terms of watch or repl in a modal sense. i am making changes throughout the project and saving the files (and using git, etc), and periodically opening a REPL just to work on a small thing
otherwise you run into issues like before where a namespace defined at the REPL clashes with something in a file
personally that is what i would have expected to happen, but i may have a less repl-driven workflow than others
my CLJS workflow isn’t REPL driven at all, thats why I never got into this situation before
for CLJS I usually have a watch running and just very occasionally poke at it with the REPL
That seems to work @thheller nice find!
Btw with Figwheel watch keeps working even when we are connected with a repl, which actually kinda works
Ah ok, for me it kinda works because I mostly use the repl to get autocomplete in emacs 😛
Is there a way to use shadow/repl
or shadow/dev
with nrepl?
yeah its the shadow.cljs.devtools.api
namespace. can’t figure out how to make cursive use shadow.user
ns.
If i try (shadow/watch :app)
it says missing instance
I try this from a nrepl connection from a connected repl
I saw this note: This DOES NOT WORK while in nREPL unless your nREPL client supports needs-input.
Yes pretty much, I start it from within emacs
Ah and then just connect?
You mean embed the server which starts an nrepl server? I woul prefer that tbh
What I actually tried to do is start 3 workers when I start my dev env
Ah ofcourse
I'll play around with just connecting I do like that the npm version is so damn fast with trying stuff out and restarting
And I don't have to play dependency puzzle with shadow-cljs
Yes ofcourse
I use cider not sure if you want to support that?
should I do:
:nrepl {:port 3002
:middleware
[cider.nrepl.middleware.apropos/wrap-apropos
cider.nrepl.middleware.classpath/wrap-classpath
cider.nrepl.middleware.complete/wrap-complete
cider.nrepl.middleware.debug/wrap-debug
cider.nrepl.middleware.format/wrap-format
cider.nrepl.middleware.inspect/wrap-inspect
cider.nrepl.middleware.macroexpand/wrap-macroexpand
cider.nrepl.middleware.ns/wrap-ns
cider.nrepl.middleware.pprint/wrap-pprint
cider.nrepl.middleware.pprint/wrap-pprint-fn
cider.nrepl.middleware.refresh/wrap-refresh
cider.nrepl.middleware.resource/wrap-resource
cider.nrepl.middleware.stacktrace/wrap-stacktrace
cider.nrepl.middleware.test/wrap-test
cider.nrepl.middleware.trace/wrap-trace
cider.nrepl.middleware.out/wrap-out
cider.nrepl.middleware.undef/wrap-undef
cider.nrepl.middleware.version/wrap-version]}
I am playing around with thatyes if you want to use that. guess its needed if you want to use some cider features
Yeah but it seems to break stuff
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of null, see clojure.tools.middleware/set-descriptor!
NullPointerException:
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
clojure.core/comp/fn--5529 (core.clj:2561)
shadow.cljs.devtools.server.nrepl/start (nrepl.clj:243)
shadow.cljs.devtools.server.nrepl/start (nrepl.clj:233)
shadow.cljs.devtools.server/start-system (server.clj:129)
shadow.cljs.devtools.server/start-system (server.clj:94)
shadow.cljs.devtools.server/start! (server.clj:180)
shadow.cljs.devtools.server/start! (server.clj:172)
shadow.cljs.devtools.server/start! (server.clj:175)
shadow.cljs.devtools.server/start! (server.clj:172)
shadow.cljs.devtools.server/from-cli (server.clj:280)
shadow.cljs.devtools.server/from-cli (server.clj:256)
shadow.cljs.devtools.cli/blocking-action (cli.clj:98)
shadow.cljs.devtools.cli/blocking-action (cli.clj:90)
shadow.cljs.devtools.cli/main (cli.clj:139)
shadow.cljs.devtools.cli/main (cli.clj:101)
clojure.core/apply (core.clj:661)
clojure.core/apply (core.clj:652)
shadow.cljs.devtools.cli/-main (cli.clj:178)
shadow.cljs.devtools.cli/-main (cli.clj:176)
clojure.lang.Var.applyTo (Var.java:702)
clojure.core/apply (core.clj:657)
clojure.main/main-opt (main.clj:317)
clojure.main/main-opt (main.clj:313)
clojure.main/main (main.clj:424)
clojure.main/main (main.clj:387)
clojure.lang.Var.applyTo (Var.java:702)
clojure.main.main (main.java:37)
Actually the only thing I want to work is autocompletion and a working repl for clojurescript 😛
Yeah probably will check it out
Oh I do remember something about how they made all middleware dynamic, will investigate further
Yeah but cider depends on the new snapshot
:nrepl {:port 3002
:middleware
[cider.nrepl/wrap-apropos
cider.nrepl/wrap-classpath
cider.nrepl/wrap-complete
cider.nrepl/wrap-debug
cider.nrepl/wrap-enlighten
cider.nrepl/wrap-format
cider.nrepl/wrap-info
cider.nrepl/wrap-inspect
cider.nrepl/wrap-macroexpand
cider.nrepl/wrap-ns
cider.nrepl/wrap-out
cider.nrepl/wrap-refresh
cider.nrepl/wrap-resource
cider.nrepl/wrap-spec
cider.nrepl/wrap-stacktrace
cider.nrepl/wrap-test
cider.nrepl/wrap-trace
cider.nrepl/wrap-tracker
cider.nrepl/wrap-undef]}
This one seems to work@mhuebert just pushed [email protected]
with support for source maps in :bootstrap
. not sure if you actually need them but it also fixed errors not showing proper locations you mentioned a few days ago.