has anyone dealt with a stale client? I'm not sure why it decided to start doing this. I've tried restarting everything.
@ajsnow2012 usually this means the browser has an old version
are you sure the cache of your browser is disabled?
i.e. devtools > network tab > disabled cache ticked (don't worry, it will only be disabled while, devtools are open)
I will try this, thanks!
Hello! I'm new to cljs and trying to start a clean project from re-frame-template. I'm constantly getting the same error while jack-in: websocket.cljs:12 WebSocket connection to '<ws://127.0.0.1:9630/api/remote-relay?server-token=1f29b682-7f54-413e-84da-7388b53919df>' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
. How can I solve it? REPL is not working too in VS Code, but for Clojure (not a script one) it's working fine. Tried both Chromium and Firefox.
@ajsnow2012 did you maybe change your :output-dir
or :modules {:main ...}
to :modules {:app ...}
or so? anything that affects where the output goes basically but did not update your HTML to load that code and instead still load the old stuff?
Anyone using shadow-cljs with Cursive on Windows?
@bohdan.mikhail looks like shadow-cljs isn't running? or running on a different port but not having compiled yet?
@info902 I am 😉
Ok then there is hope for me. I couldn’t get it working yesterday. But that are some of my first steps in ClojureScript anyway , before only Clojure
@thheller VSCode says that all should works fine, according to logs
shadow-cljs - HTTP server available at <http://localhost:8280>
shadow-cljs - server version: 2.11.0 running at <http://localhost:9630>
shadow-cljs - nREPL server started on port 8777
I tried to get @jacek.schae project working in Cursive
Can it be caused by running under WSL?
I use WSL2 but since today I do all coding directly in Windows
Anyone have any insight about what the correct value for :asset-path
is for a :bootstrap
build is? If I try to do advanced compilation, I get errors about goog not found from the bootstrap stuff in particular.
@bohdan.mikhail if you run under WSL2 then you must use the IP of that virtual machine to connect since it is not running under localhost anymore
(or forward the port from windows)
Sorry mixed up with your discussion 😆
(maybe :advanced doesn't work with bootstrap, who knows?)
@pmooser :bootstrap
does not have that setting at all. :advanced
is not compatible with bootstrap, must use :simple
Ok, thanks. I will give it a try. Does that mean both of my builds have to be :simple
? (ie both the app and bootstrap builds)
yes
That appears not to work at all for me, but thanks for the info.
@info902 whats your issue then? most of the time I run my stuff directly under windows, sometimes under WSL1. WSL2 is kinda annoying because of the IP but easy enough if you just use a hostname for that machine vs an IP
Well I opened the ReFrame Pro project in IntelliJ and as its a Shadow-cljs project / no Leiningen .... I couldn’t get the repl connected to the started project . I tried all kind of things to get the Cursive repl working. Calva worked fine
@thheller it's a little bit confusing, because the web page opens like it's at the localhost but a ws connection should be port-forwarded. Don't they work in the same manner?
I found that the VS Code or maybe Windows itself performing port forwarding on opening link step (clicking to it in the editor) because typing in the browser is not working without explicit forwarding
Must be a beginner problem 😐
@thheller Is the fact that :advanced
doesn't work with :bootstrap
a shadow-cljs limitation, or a fundamental self-hosted cljs limitation?
fundamental, it cannot work ever anywhere.
@info902 well what DID you try? do you have a hardcoded :nrepl {:port 9000}
or so in your shadow-cljs.edn
?
also see https://shadow-cljs.github.io/docs/UsersGuide.html#_cursive
@thheller Ok, I'm trying to use :simple
for both my :app
and :bootstrap
targets ... and when I try to load the page, I get some shadow-cljs logs that say "failed to load 8" "failed to load 16" and "failed to load 23" each of those is a jsRequire call of some sort ... can you provide any hints about debugging what might be causing this?
Yeap / :nrepl {:port 333} and npm run dev starts up
Damn, I just deleted the whole .idea project and recreated it new. This time directly with the pom.xml
Looks better now with Cursive
hmm how do you access the webpage?
Hi, I'm having some trouble with some node.js requires, when I require then using :js-provider :shadow
(requiring then on the ns form). For example, jsdom
have the following code somewhere:
exports.Canvas = null;
let canvasInstalled = false;
try {
require.resolve("canvas");
canvasInstalled = true;
} catch (e) {
// canvas is not installed
}
if (canvasInstalled) {
const Canvas = require("canvas");
if (typeof Canvas.createCanvas === "function") {
// In browserify, the require will succeed but return an empty object
exports.Canvas = Canvas;
}
}
This makes shadow-cljs expects to have canvas
installed. Is there a workaround, or should I use the default :js-provider
and use something else to bundle my js file?
this pattern isn't supported (ie. require.resolve
)
you can set :js-options {:resolve {"canvas" false}}
so it won't bundle it
that might kind of work but is rather horrid thing to do
@thheller Hi there, I’m trying to get either npm-module or :esm to pop me a repl in the browser. Cljs being imported from javascript in nextjs. Want a way to use cljs libs from nextjs applications.
But neither is connecting back to the shadow watcher
Do they support repl in the browser?
don't use :esm
when embedding into other targets. thats needs a lot more work before that becomes practical.
Would you suggest using :browser?
:npm-module
should work fine *BUT* you need to ensure the REPL ns is loaded from JS
right, which ns is this?
so wherever you do (require "./cljs/whatever.your.ns")
the ns is shadow.cljs.devtools.client.browser
you can if if (process.env.NODE_ENV === "development") { require ... }
in the JS
don't know what your JS looks like
cool. So in dev, load shadow.cljs.devtools.client.browser
perfect
got you
Would be interesting to have a discussion about esm
sometime. I have a large interest in getting seamless TS and cljs interop. But don’t always control the bundling experience
What are the options for shipping cljs core in an npm package, and then having cljs compile in place (same directory), but with a require on cljs? Not sure if I made sense here.
Thanks for the help!
cljs.core as npm package to be included in other CLJS builds is pretty much a no go
or rather not something I'm interested in working on or supporting
just goes completely against what :advanced
is supposed to do