This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-16
Channels
- # announcements (7)
- # babashka (1)
- # beginners (25)
- # calva (7)
- # cider (15)
- # clj-kondo (13)
- # cljdoc (14)
- # clojure (151)
- # clojure-europe (4)
- # clojure-hamburg (2)
- # clojure-italy (22)
- # clojure-nl (57)
- # clojure-spec (12)
- # clojure-uk (6)
- # clojuredesign-podcast (5)
- # clojurescript (12)
- # core-async (8)
- # cursive (26)
- # datascript (9)
- # datomic (92)
- # emacs (4)
- # fulcro (7)
- # graalvm (1)
- # graphql (2)
- # instaparse (3)
- # jobs (1)
- # jvm (2)
- # kaocha (6)
- # nrepl (3)
- # off-topic (5)
- # re-frame (45)
- # reagent (5)
- # reitit (18)
- # ring (1)
- # shadow-cljs (89)
- # slack-help (9)
- # spacemacs (2)
- # sql (54)
- # tools-deps (75)
- # vim (28)
- # xtdb (17)
- # yada (31)
@thheller We have observed significant performance regressions with console.log
in shadow-cljs vs upstream ClojureScript (e.g. figwheel) with large and complex nested data structures. Are you aware of any issues regarding that ? I think it has to include vectors to trigger the issue i.e. heavily nested {:key [ { ... } ...]}
and not just {:key {... { ... }}
. We are working on a reproducible test case but just wanted to get feedback from you before we work more on that.
When I say 'performance regressions' it is on the order of milliseconds (upstream cljs) vs 30 seconds (shadow-cljs) for some data structures.
the only difference I can think of is the built-in minimal console formatters support vs using cljs-devtools?
try either using cljs-devtools
(just add the dependency) or :devtools {:console-support false}
Still slow with both, working on trying to pull a reproducible test case out of the app with the issue.
that is pretty much the only thing that even has the potential to make console.log
slow
Should :after-load
fire for :node-script
apps? I get :before-load-async
but not :after-load
?
@macroz well did you call the callback argument passed to :before-load-async
? otherwise it won't proceed.
@jiyinyiyong that is the maven library handling the download of :dependencies
. last time I tried changing how that was handled (and downloaded less) you complained about it not working with the chinese firewall and stuff
I still have problem downloading the jar sometimes when I use latest versions which has not been mirrored.
but it's true npm packages takes really large disk space. normally 35M for https://github.com/TopixIM/woodenlist
maybe I'll revisit the different download strategy. makes sense given how many people use deps.edn/project.clj anyways
compared to how many other node_modules
you have installed I guess it is probably fine 🙂
Does anyone know how to turn on profiling in production with React developer tools using shadow-cljs? Dev environment seems to support that just fine by default, although I don't see an explicit option anywhere. The official doc refers to CRA and Webpack configs in order to enable this option: https://gist.github.com/bvaughn/25e6233aeb1b4f0cdb8d8366e54a3977
@thheller thanks that did the trick, the callback where the done-call was wasn't called
it starts a server on a port and I had to add a manual wait for it to close to be able to bind again
@andrey.krasnov.pm seems like :js-options {:resolve {"react-dom" {:target :npm :require "react-dom/profiling"}}}
https://shadow-cljs.github.io/docs/UsersGuide.html#js-resolve
Whoa, thank you very much! Testing now...
Hi! I'm trying to use basscss in my project. Basically I need to load the css contained in the basscss node module, which I installed with npm. How to do this?
Is it intended that :repl {:middleware}
doesn’t get applied from the global config.edn
to every project?
You probably have a cache issue. 8 days ago someone asked the same question, you can still find the thread via the search box.
Thanks but I have cleared cache in chrome, disabled caching in the network tab, and I'm using the built in server. Still see this message.
make sure your index.html is pulling in the right js file, that you’re building the right build in the right dir, etc.
Yepp, thank you, I was trying to use /workspaces/js/main.js
instead of /js/workspaces/main.js
. Editing index.html solved it.
I've tried all of the different ways of importing npm packages (listed here: https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages) but I keep running into the SHADOW import error
.shadow-cljs/builds/renderer/dev/out/cljs-runtime/shadow.js.shim.module$react_dnd_html5_backend.js
. I'm trying to import the npm package react-dnd-html5-backend
version 9.4.0
. I'm importing other packages without problem
whats the actual error? this is just telling you WHAT failed. the WHY is either further up or down depends on the error
@thheller This is what I'm seeing. I think it may be because I'm developing an electron app and the target is set to node-library
.
If I just try and require the package using the electron node then I see this error:
So, is it because the package i'm requiring is using an import HTML5Backend
and that syntax isn't supported for node-library
?
:node-library
just uses require
and lets node resolve it. which seems to fail because of the import
ok, understood. I'm not doing a browser
build because some of the other packages required are node specific and aren't supported in the browser. I'll add another build and see if I can find a way to separate out the code into a browser package and a node package.
@U4YGF4NGM it's an electron app so it's a weird mix of node and the browser. You have a browser window but you can also use node packages
I’m not sure how the build process is working but I would ensure that you are only including that library in the build that gets loaded in the electron window, not the backend script
@U4YGF4NGM you can use require
directly in the "renderer". so in the browser.
I'm using a node library (https://github.com/automerge/hypermerge) for the state management. I can require this in the browser
Even though it wouldn't work in a regular browser
$ npm i react-dnd-html5-backend
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ [email protected]
added 7 packages from 5 contributors and audited 112 packages in 1.068s
found 0 vulnerabilities
$ ls node_modules/react-dnd-html5-backend/dist/cjs
BrowserDetector.js HTML5Backend.js NativeDragSources OffsetUtils.js getEmptyImage.js utils
EnterLeaveCounter.js MonotonicInterpolant.js NativeTypes.js OptionsReader.js index.js
so you could use :keep-native-requires true
and :keep-as-require #{"the-libs" "that-work"}
Thanks for the suggestions. Will explore the two builds and cjs
approaches :thumbsup:
["react-dnd-html5-backend/dist/cjs" :default HTML5Backend]
seems to be working 🎉
Is there any obvious reason why (js/require "./assets/images/my-image.png")
wouldn’t work in a react native project? I’ve checked that the file exists. Getting an error that it “doesn’t exist in the Haste module map”
@U4QC052UQ one thing to note/check is that the path is relative to the shadow-cljs :output-dir, not the top-level of your project. Since I typically do something like
:output-dir "target"
, for me I would typically need “../assets/images…Ah, I didn’t consider doing ..
. Good call!
I’m suspecting that something about the way I’m requiring the image is off
bizarre broken compiled output in dev mode (haven’t tested release):
amperity.admin.ui.srv.authn.logout_BANG_ = (function amperity$admin$ui$srv$authn$logout_BANG_(){
if(cljs.core.truth_(amperity.admin.ui.srv.authn.web_auth)){
return .logout(({"clientID": amperity.admin.ui.srv.env.auth0_client_id, "returnTo": amperity.admin.ui.srv.authn.current_root_uri()}));
} else {
return null;
}
});
offending CLJS code:
(defn logout!
"Log the user out of Auth0."
[]
(when web-auth
(.logout ^js web-auth
#js {:clientID env/auth0-client-id
:returnTo (current-root-uri)})))