This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-25
Channels
- # babashka (7)
- # beginners (116)
- # cljfx (2)
- # clojure-europe (6)
- # clojure-korea (4)
- # clojure-nl (1)
- # clojure-uk (1)
- # conjure (3)
- # data-science (3)
- # datahike (4)
- # events (4)
- # hyperfiddle (3)
- # missionary (11)
- # off-topic (134)
- # pedestal (1)
- # reitit (4)
- # releases (2)
- # shadow-cljs (12)
- # sql (3)
- # squint (1)
- # yamlscript (12)
@hifumi123 I'm not joining that current #C03RZGPG3 discussion, but since @p-himik mentioned me, I feel its relevant to answer here. :target :browser
is soft-ish deprecated, but never going anywhere. :target :esm
is its replacement, which also fully support code-splitting, and even more relevant can rely on the browser for doing the dynamic loading and not this horrific google closure-library based ModuleLoader thing, which should have been replaced years ago.
:esm
is just the better choice given that all relevant browsers have supported it for years
Since I'm lazy myself I haven't switched everything over to :target :esm
for my own things, so it might still have rough edges. If someone makes me aware of them I'll definitely address them.
But the :esm
does not support the module-loading functionality that :browser
offers. Is that correct? If so, what’s the workaround for projects making use of module loader? Dynamic ESM import?
correct, dynamic esm import replaces all previous loader functionality. which arguably is still a bit annoying to use due to the closure compiler trying to compile it away, but it does work.
(the annoying part being that you can't just write (js/import ...)
but have to use the shadow.esm/dynamic-import
instead, the capabilities are otherwise identical)
So, I’m trying to use patternfly from shadow-cljs. patternfly consumes the css directly via the ts code via a require. This causes shadow-cljs to stop the compilation as it doesn’t know what to do AFAICT. Are there any solutions to this problem and how the authors of patternfly want to load css?
The require in question:
["@patternfly/react-core" :refer [Badge]]
The resulting error from shadow-cljs
Failed to inspect file
/<dev-path>/node_modules/@patternfly/react-styles/css/components/Button/button.css
Errors encountered while trying to parse file
/<dev-path>/node_modules/@patternfly/react-styles/css/components/Button/button.css
{:line 1, :column 1, :message "primary expression expected"}
correct, shadow-cljs does not support .css files. you can tell it to ignore those and just continue without them, but then you'll have to use something else to get the css processed in some way
so option one is letting something like webpack process all JS+CSS dependencies via https://shadow-cljs.github.io/docs/UsersGuide.html#js-provider-external