This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-19
Channels
- # announcements (37)
- # aws (6)
- # babashka (12)
- # babashka-sci-dev (16)
- # beginners (83)
- # biff (10)
- # cider (14)
- # cljdoc (26)
- # cljs-dev (20)
- # clojure (123)
- # clojure-czech (9)
- # clojure-europe (26)
- # clojure-nl (4)
- # clojure-norway (20)
- # clojure-spec (7)
- # clojure-uk (6)
- # clojured (14)
- # clojurescript (28)
- # cursive (5)
- # datalevin (8)
- # datomic (3)
- # duct (6)
- # emacs (26)
- # events (2)
- # fulcro (7)
- # gratitude (1)
- # holy-lambda (19)
- # integrant (1)
- # jobs (2)
- # leiningen (8)
- # lsp (7)
- # nyc (1)
- # pathom (70)
- # re-frame (8)
- # reagent (15)
- # releases (1)
- # sci (8)
- # shadow-cljs (117)
- # testing (5)
- # tools-deps (11)
- # vim (5)
@zhuxun2 the asset path is not currently available in the code. goog.DEBUG
depends on what you do, in theory it can allow to remove some code yes
When I am using shadow-cljs with some arbitrary npm, I often struggle a bit to try to figure out the right way to refer to elements in the javascript package. Once I do a basic require of something, is there any way to introspect or look inside it to see what it provides?
For example, I just installed an npm called rc-slider
, and in their example, they do this (in js):
const Slider = require('rc-slider');
const createSliderWithTooltip = Slider.createSliderWithTooltip;
const Range = createSliderWithTooltip(Slider.Range);
I'm trying to use this reagent library reagent-mui, and when I import a specific namespace, I see some load failures from shadow-cljs in my console:
shadow-cljs - failed to load module$node_modules$$mui$material$node$styles$ThemeProvider
shadow-cljs - failed to load module$node_modules$$mui$material$node$styles$index
I looked at the related stack traces, and they mention the bootstrap build, so I tried to exclude the ns
I imported from the bootstrap build, but with no effect.@pmooser if you are on an old shadow-cljs version you should upgrade. that error message should be clearer now. you are pasting irrelevant parts
Ok, I've updated to 2.18.0
, and now here's a more complete error message:
(It won't let me copy/paste the exception info as text, so here's an image)
@U05224H0W Here is the rest of that stack trace from above:
@U05224H0W I see bootstrap again in those stack traces, but I haven't succeed so far at excluding things and making the error go away.
I mean the stack trace contains a line like this, that makes me wonder if the bootstrap build is implicated in causing this problem:
at Object.shadow$cljs$bootstrap$browser$script_eval [as script_eval] (browser.cljs:38:4)
Anyway, I can just not import this namespace. It's not vital, but it's just odd to have an import of a namespace break things.
If I can't figure out what is making it emit errors on every CSS reload, I'll probably have to revert to an older shadow-cljs too.
@U05224H0W I know that hot-reloading bootstrap code doesn't work. I have a couple builds, one of which is a bootstrap build, but it's just for an embedded repl that I use in my application. What information would be useful, if the stack traces are all not sufficiently informative to figure out what the bugs are? I don't really need the bootstrap build to be compiling anything in my app that is related to the UI, so strictly speaking the namespace that is even loading this code isn't relevant at all to bootstrap.
you mean you have 3 builds in your page? your regular app, your embedded REPL and the boostrap?
The embedded repl is part of my normal app. For development purposes, I have either 2 or 3 builds running. The simpler case is something like: shadow-cljs watch app-simple bootstrap
can you be more specific about the embedded REPL thing? self-hosted interacting with a regular watch is pretty much guaranteed trouble
I feel like every time there's an issue with bootstrap and I ask a question, it turns out that bootstrap is the source of all problems in the world.
I think I'll just do the work to switch over to sci
instead of using the bootstrap build,
self-host is just the most complicated thing you can do. so it is easy to make mistakes and screw something up
if you just want a eval
for development purposes you can use https://clojureverse.org/t/status-update-inspect-cljs-eval/6074#cljs_eval-2
I have an application - a fairly normal reagent-based cljs application. As part of that application, I have a window that will evaluate code that I type. This is not the core of the application, but it's an extremely useful capability in the app, for a variety of reasons. I use the bootstrap build because to my knowledge that's the way to support that.
Yeah. So I think due I guess to the unfortunate nature of bootstrap, the best thing for me (and for you, so I stop bugging you with questions about a part of the cljs ecosystem that I suppose just doesn't work very well) is probably to migrate to sci
. That way, there's no mysterious build happening anymore, which I imagine will eliminate most of these issues.
Any insight on what might be causing that error on CSS reload in shadow-cljs 2.18.0
that I mentioned above?
it works just fine. just easy to make mistakes and use incorrectly. thats the nature of the system, if you use it correctly it works fine.
Well, I've been using bootstrap like this for ... 2 years now? Generally it works. It's just that when it doesn't, it's not clear how to fix it.
you might have the bootstrap parts load some code that is already loaded and overriding important parts
I have some things exluded from the build, but I don't even see :exclude
mentioned in the docs anymore (?)
@U05224H0W So when I try to revert to the previous shadow-cljs version I get some errors, so I'm once again trying to fix this CSS reloading error I'm seeing with 2.18.0
.
You said before you didn't know "what I was doing", but I have a basic reagent application. I'm doing a shadow-cljs watch my-build bootstrap
and basically if I modify my site.css
file, I get a shadow-cljs exception in my console when it reloads my site.css file.
It also doesn't overwrite or update an existing style, but seems to load/create duplicate styles (if I'm looking at elements in a chrome inspector).
What kind of information could I provide that would help to debug this?
I will try to migrate away from the bootstrap build but that takes a little bit of work for me also.
the css thing failing is most likely just a symptom of something else going wrong before that
How would you track it down, since there are no other errors or warnings appearing in the console, and the only place I've noticed a side effect of this error is in the element inspector in chrome (where it is visible that it is failing to replace styles) ?
my guess is on the bootstrap stuff being loaded out of order or replacing the bootstrap compiled ns with one compiled by shadow-cljs
I guess I'll proceed along the path of trying to remove the bootstrap build and see if that helps anything.
if the problem goes away if you just don't init the bootstrap stuff that should provide good information
Thank you, and understood. It sounds like this path isn't a bad idea regardless, and I'll be sure to update you if the problem disappears after removing bootstrap.
I can't tell from the error excerpt you posted but is this log showing up just before the css is failing?
also are you sure you upgraded shadow-cljs properly and restarted it after? too often people just update the npm package while still having an old version in deps.edn/project.clj
• I'm not using :dev/asset-load
anywhere in the code at all.
• I'm sorry but I don't understand the question about the log showing up - at this point, the only error occurring is when I save my CSS file, and shadow-cljs reloads it - that's when these log messages show up, and there are no other errors or warnings before or after. Please help me understand what I'm failing to explain here.
• Where should I put that (devtools-msg ...
line?
you should not put that anywhere. in your stacktrace of the css error it is pointing to browser.cljs line 141
I just forcibly removed the bootstrap build/etc and for now it appears the error may be gone.
that would be that line, which immediately before that has the log line that should show up in the console
but that piece of code should only even be called when you have a :dev/asset-load
hook
:aliases {:shadow-cljs {:extra-deps {thheller/shadow-cljs {:mvn/version "2.18.0"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
That's my alias I'm using to launch shadow-cljs - I don't see how that could not be 2.18.0 but I'm not super expert at deps.edn so maybe there's some way.
I didn't know that :dev/asset-load
exists, so it definitely isn't in my code, and I've verified this by grepping everything in the project.