This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-17
Channels
- # announcements (2)
- # aws (4)
- # babashka (20)
- # beginners (256)
- # calva (15)
- # chlorine-clover (1)
- # cider (12)
- # clj-kondo (25)
- # cljsrn (16)
- # clojure (115)
- # clojure-europe (7)
- # clojure-finland (5)
- # clojure-italy (10)
- # clojure-nl (35)
- # clojure-spec (13)
- # clojure-uk (83)
- # clojurescript (42)
- # code-reviews (81)
- # conjure (8)
- # cursive (6)
- # data-science (1)
- # datomic (3)
- # duct (18)
- # emacs (2)
- # figwheel-main (40)
- # fulcro (21)
- # helix (1)
- # jackdaw (7)
- # java (2)
- # lein-figwheel (5)
- # luminus (1)
- # observability (12)
- # off-topic (32)
- # parinfer (5)
- # pedestal (19)
- # re-frame (5)
- # reagent (8)
- # reitit (17)
- # rewrite-clj (47)
- # rum (19)
- # shadow-cljs (48)
- # spacemacs (4)
- # sql (40)
- # tools-deps (22)
- # vrac (1)
- # xtdb (25)
We’re requiring a js file like so:
["/graphql/subscriptions" :as subscriptions]
It has an assignment like:
export const onCreateBag =
subscription OnCreateBag {
...
Works fine in dev, but on release (:advanced) the onCreateBag
gets munged to $onCreateBag$:
and we can’t really use it as a key. This only became a problem from shadow-cljs 2.9.6 onward. (Same code works in 2.9.6 but not on any version after that including 2.10.9)
Is there an easy way to tell shadow not to munge that?
The only other thing unusual is the graphql/subscripitions.js
is being required from a Clj dependency of another library as a git dependency in deps.ednOn a side note, is there an easy way to run a release build locally without setting up a whole webserver environment?
@rberger what kind of JS is that? am I missing something or is this processed in any way? this isn't valid JS subscription OnCreateBag {
?
why do you have pseudo-names activated? or is that just to show that it is getting renamed?
I'm surprised that it wasn't getting renamed previously. It should always been renamed but if it wasn't that was a bug.
in which context are you relying on the name? if you are passing the whole ns as an object to something than that is something you shouldn't be doing in the first place
I just put a snippet for the js. But this evening we re-evaluated what we were doing and realized we didn’t need this in JS and switched it all to clojurescript and EDN. So our problem is solved by removing those JS files and replacing with cljs. The use case was a bit funky. The JS files were being generated by CI from some authoritative schema in one project / repo and we needed to get them on the classpath of other projects/repos. I had built the image with --debug on so it was generating psuedo-names to help us figure out where the problem was originally. The one other JS file that we did need to have (`aws-exports.js`) is importing fine. The main weird thing was it all worked in 2.9.6 and earlier. If you want me to gather any other info, let me know.
@rberger well it should have always worked like it does now. the renaming is intentional. you can add externs to stop the renaming. not quite sure why it wasn't renamed before
Yeah, I was wondering if externs would have been the correct answer if we were to continue with that path.
I don't know what your setup is. I run shadow-cljs release whatever
locally constantly.
I cannot possibly answer that. I design my dev builds to be as close to release as possible so I can just switch between them locally without issue.
I guess I’m asking is there a way to use the shadow-cljs http server to run the release build
if you just need a static server sure. just run shadow-cljs server
seperately and keep it running.
https://www.reddit.com/r/Clojure/comments/haqw43/shadowcljs_generating_es_modules_browser_deno/
You mentioned that snowpack
was one of the triggers for this. Is there some usable relationship between cljs/shadow-cljs and snowpack for doing cljs development?
[shadow.esm :refer (dynamic-import)]
🤯edit: nevermind :D
Hi! I'm using cljs.test and playing with helix and integrating with some npm react library components.
1. How do you run tests in intellij cursive repl when using shadow-cljs?
2. What does it mean by "node REPL"? Is it enough to run tests that needs browser functionality, like simulating click events (I'm not talking about webdriver or opening real browser here. In JS land, there js-dom https://github.com/jsdom/jsdom)?
I'm looking into this guides now, but still struggling to digest the content.
https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-test
https://clojureverse.org/t/any-tricks-in-writing-clojure-script-tests/1016/2
PS:
I've tried the :browser-test
option before, I'm just exploring other option to see which one works well for me.
@jaime.sangcap Good luck. I'm not sure about incorporating testing into shadow-cljs but i would recommend getting them to run from the command line.. incorporating them into intellij later will be simple (in theory)
if my project uses deps: true
, and my deps file includes a library via :local/root "../lib-name"
, does shadow handle the installing of that libraries package.json file? I’m trying to figure out how to package and deploy that library for consumption, and unsure if I need to npm install
and bundle it. Sorry if the question is super basic
@haywood it does not look at the package.json no. the library can include a deps.cljs
with {:npm-deps {"foo" "version"}}
in one of its :paths
. those will be installed.
I was reading about the deps.cljs. How is it added to the JAR? there is any extra step to do it or just using depstar would do it?
no clue what depstar does. it should just put the file in it automatically, just like any other source file.
oh, so it should be inside a folder like src
for example?
thanks
huge ➕ 1️⃣ on supporting native ESM via CLJS. really glad you’re willing to take on the work to provide us with that, thheller
of course, but there are measures in between that and not supporting it, like you have already done 😄
:modules {:shared
{:entries []}
:main
{:init-fn app.client/init
:depends-on #{:shared}}
:worker
{:init-fn app.worker/init
:depends-on #{:shared}
:web-worker :true}}
:devtools {:after-load app.client/refresh
:browser-inject :main
:preloads [com.fulcrologic.fulcro.inspect.preload]}}
I'm trying to test out web workers. I'm getting an error with the above because the preload expects to have access to document
. Is there a way to preload at the module-level rather than the build-level? I also tried splitting the web worker module into a completely separate build, but that resulted in an error about goog.debug.Error
(for example) already being declared. Perhaps the answer is still multiple builds, but there's something else I need to do to limit the output of the web-worker build? Or wrap the preload in something that checks its environment?@ericihli just move the :preloads
to the :main
module. they can be specified per module
You mentioned that snowpack
was one of the triggers for this. Is there some usable relationship between cljs/shadow-cljs and snowpack for doing cljs development?