This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-16
Channels
- # announcements (7)
- # babashka (8)
- # beginners (48)
- # calva (4)
- # cider (6)
- # circleci (2)
- # clj-commons (14)
- # clj-kondo (3)
- # clj-on-windows (7)
- # cljs-dev (34)
- # clojure (49)
- # clojure-dev (25)
- # clojure-europe (48)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-norway (33)
- # clojure-uk (2)
- # clojurescript (37)
- # community-development (5)
- # conjure (17)
- # cursive (2)
- # data-science (1)
- # editors (10)
- # emacs (50)
- # events (22)
- # honeysql (11)
- # introduce-yourself (1)
- # jobs-discuss (13)
- # lsp (42)
- # malli (9)
- # off-topic (7)
- # pathom (11)
- # portal (5)
- # re-frame (3)
- # reagent (22)
- # reitit (8)
- # reveal (1)
- # rewrite-clj (4)
- # shadow-cljs (38)
- # xtdb (21)
Any hints on enabling react production builds for a reagent app? Even when I'm compiling with advanced optimizations, it seems like I'm getting the dev build, unless I'm mistaken ...
Both regular Cljs compiler and Shadow-cljs automatically use the production React build
That doesn't appear to be true. I mean, I understand that it is supposed to be true, but I have this:
:release {:compiler-options {:optimizations :advanced
:infer-externs :auto}}
I'm digging into my build in more detail to see if it is actually doing what I expect it to do.
With some tools, you are able to set NODE_ENV yourself and that will affect which React version is used, but I don't think you can do that accidentally: https://github.com/reagent-project/reagent/commit/eb3b96002fb258f9707b18063d7b4bcb73132144#diff-274071745a4e2a04b647d79d500537e6dc13eee54f44d0426140026293701d1b
Yeah, I mean I just verified that I'm using the advanced build but it's still the react dev build. Thanks for the commit - I will look into it.
That one is using Cljs compiler with npm-deps, i.e. very badly supported and a non recommended setup. Shadow-cljs, Cljs compiler with Cljsjs and Cljs compiler with Webpack etc. all work differently.
Yes, I'm definitely not setting the node env (since I don't know anything about node).
Yeah, I am using shadow-cljs, but this is surely something I'm doing that is weird and not a fundamental bug.
And you probably shouldn't set it yourself. Cljs npm-deps setup sets it by default depending on the optimization value, and I think shadow-cljs does the same.
I even verified that another app at my work has it working correctly, so I will compare my build with theirs and see if I can figure out what is different.
you can verify what exactly you get via build reports https://shadow-cljs.github.io/docs/UsersGuide.html#build-report
the size isn't much different though since things are still going through :simple
optimizations
I knew I was getting the dev build due the color of the icon from react developer tools. It has a red background.