This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-24
Channels
- # announcements (8)
- # babashka (16)
- # beginners (18)
- # biff (4)
- # calva (18)
- # clj-kondo (20)
- # clojure (24)
- # clojure-brasil (1)
- # clojure-europe (13)
- # clojure-nl (1)
- # clojure-norway (35)
- # clojure-uk (3)
- # clojurescript (16)
- # core-async (50)
- # cursive (5)
- # data-science (5)
- # datalevin (5)
- # datomic (69)
- # dev-tooling (18)
- # fulcro (3)
- # gratitude (1)
- # honeysql (5)
- # hyperfiddle (4)
- # jackdaw (2)
- # jobs-discuss (24)
- # lambdaisland (7)
- # lsp (16)
- # malli (5)
- # off-topic (65)
- # overtone (16)
- # pathom (28)
- # portal (3)
- # re-frame (24)
- # releases (1)
- # shadow-cljs (101)
Hello. I’m new to CLJS and re-frame (but not to Clojure.) My first re-frame-template project was going well, until I quit the shadow-cljs REPL within Emacs.
When I restart it (using M-x cider-jack-in-cljs
), it appears to start up normally within Emacs, but the browser has a red banner that says Stale output! Your loaded JS was not produced by the running shadow-cljs instance. Is the watch for this build running?
and indeed no changes I make in the source files appear in the browser.
Anyone know what might be going on?
Yes, including empty cache / hard reload
Can you double-check where the files are served from?
E.g. if the server serves the contents of target/dev
but shadow-cljs puts its output into target/staging
, you'll also see such error.
Another potential cause is the server caching the files.
I don’t know what you mean by “the server” — whatever server there is is built into the re-frame-template or shadow-cljs
A scaffolding for making new re-frame projects, https://github.com/day8/re-frame-template/
No busy ports message, no. There were no warnings or errors
It appears that running npm run watch
on the command line (in addition to cider-jack-in-cljs
) makes it work…. I don’t recall having to do that as a seperate step the first time, but maybe I forgot.
The repl does not seem to have the usual js
namespace (e.g. (js/alert "foo")
), so it feels like something is still not working right…
I don't know how CIDER works and what it does during cider-jack-in-cljs
, but shadow-cljs itself has a server. Not an HTTP server (that one it also has), but a server per project.
That server process is the thing that actually does all the work. Most of the other commands, unless a specific flag is set, will use that server process. And if it's not started, such a command will start and own it.
Maybe the cider-jack-in-cljs
command is not aware of that behavior and somehow screws it up, I dunno.
I myself always run shadow-cljs via CLI manually (by using the watch
command) and then attach whatever REPL I need to the specified nREPL port.
> The repl does not seem to have the usual js
namespace
A symptom of it being a CLJ REPL instead of a CLJS one.
Thanks for the info.. I’m also asking over in #C6N245JGG in case someone there has more info
Yes, it’s definitely a CLJ REPL (not CLJS)
It's better to just provide a link to the thread here since we've already started a discussion. No need to proliferate threads and risk people repeating the same things in different places.
OK, I put the link there.
For the benefit of any future searchers: I deleted the project-local shadow-cljs / Cider defaults storage file .dir-locals.el
and restarted; it now works as expected, for some reason.
FYI - .dir-locals.el
isn't a 'defaults storage file' - it's file for user preferences. If they're there, it's because someone thought they were a good idea for the given project
(which of course is subject to stop being true at any point)
The template's contents are pretty vanilla
((nil . ((cider-default-cljs-repl . shadow)
(cider-shadow-cljs-default-options . "app"))))
"app"
assumes your shadow build was named app
- if it wasn't, that's the bugUser preferences are a form of defaults, are they not?
Hey @U0AFX5QNN, thanks for letting us know. Are you able to reproduce the issue? I can't, so far. I pushed a small fix to dir-locals.el
. I don't think it will fix this, but maybe.
It might - now that file is identical to https://github.com/reducecombine/icd.scroll/blob/master/.dir-locals.el (context - I've maintained a fair bit of this stuff in cider)
To try the fix:
• Clear your maven cache: rm -r ~/.m2/repository/re-frame/lein-template
• Make a fresh project: lein new re-frame my-repro +cider
• Install packages: npm install
• Go to the dir in emacs; M-x find-file my-repro
• Accept the variables with !
when prompted
• Jack in: M-x cider-jack-in-cljs
• If the fix is in place, you shouldn't get any prompts in the minibuffer. It should just print a success message.
• Kill the *cider-repl*
buffer and try jacking in again?