This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-06-07
Channels
- # announcements (1)
- # beginners (123)
- # calva (17)
- # clj-kondo (16)
- # cljfx (1)
- # cljs-dev (4)
- # clojure-austin (1)
- # clojure-conj (1)
- # clojure-europe (28)
- # clojure-nl (3)
- # clojure-norway (25)
- # clojure-sweden (8)
- # clojure-uk (6)
- # conjure (4)
- # datahike (30)
- # datalevin (2)
- # datomic (2)
- # docker (4)
- # events (1)
- # fulcro (6)
- # graalvm (9)
- # gratitude (1)
- # honeysql (7)
- # hyperfiddle (29)
- # introduce-yourself (2)
- # jobs (2)
- # off-topic (18)
- # pedestal (5)
- # reitit (3)
- # releases (3)
- # remote-jobs (3)
- # scittle (18)
- # shadow-cljs (31)
- # tools-build (44)
- # tools-deps (10)
If I have a Button/index.js
file on my classpath, is requiring it via (:require ["/Button" :refer [Button]])
expected to work? I am getting:
FileNotFoundException: /home/tamayo/projects/bread-cms/marx/out/Button (Is a directory)
I also tried (:require ["/Button/index.js" :refer [Button]])
but that The required JS dependency "Button/index.js" is not available, it was required by "systems/bread/alpha/marx/field/bar.cljs".
Edit: I can get this to work (via the first :require
form) if I move Button.js
up a level instead of having the folder there. I'd prefer it if components could live in the same directory as their styled-components files, Storybook stories, etc., and not have to co-mingle all those things or relegate the styles etc. to a different directory. But I can live with it if this is not supported.there is no npm-guess-what-file-it-is nonsense for the classpath, so you refer to the exact filename by default. I even regret allowing the .js
to be optional
but note that you can get all the npm style behaviour if you do NOT use the classpath, which I do not recommend anyway
so instead you use the :js-package-dirs ["node_modules" "packages"]
option and have all your components in say packages/your-components/Button/index.js
this has the added benefit of not running your JS components through :advanced
which will likely save you some externs trouble
That makes sense, thank you Thomas. I am writing components in JSX, so it goes through Babel. So in that case do you recommend just putting the output dir in :js-package-dirs
?
and yes, you put the output into packages/your-components
or whichever name you prefer. important bit is that it must be a sub directory and that directory should contain a package.json
. usually npm init -y
in that dir is enough
basically you are replicating the structure of the node_modules
folder, just with a "package" you are building yourself
Got that working, thanks again!
hmm, it appears that shadow-cljs
does not pick up on changes to files in that dir. I can see out/Button/index.js
changing but the shadow-cljs watch
command does not, and even a Force compile does not pull in the new JS. Is this expected?
yes, this is treated like node_modules
. so only package.json
is watched. if you make your babel build touch package.json
it should work
I have watch-dirs
set to public
. Inside that dir I have a symlink to another dir, and inside that symlinked dir i have a file that is symlinked. When I modify the file the symlink is pointing to shadow-cljs does not pick up that it has changed. Is there something I can do to get it to pick up changes to symlink targets?
Ok. I will continue hitting refresh like an absolute animal. 🙈
For context: I have some CSS that I use across different codebases and I have symlinked to it.
only option that is set is this one https://github.com/thheller/shadow-cljs/blob/8a93b43b43f4242b6f5f0406171155f575648860/src/main/shadow/util/FileWatcher.java#L77
I suspect that it just treats the symlink as its own file, and since that doesn't change it doesn't trigger
Ah ok I see.
Let me test that.
Touching the symlink didn't work. It's being included from a different stylesheet like this:
@import url("dopeloop.css");
When I touch the parent CSS file (the one with the the import above) that file is reloaded but the import doesn't reload. Would you expect imported CSS to be reloaded?I'll see if I can simplify this setup anyway.
Ah ha that must be it then, thanks. 👍
Just a quick follow up - I fixed this by using a directory symlink instead of a file symlink as you suggested.