Fork me on GitHub
#shadow-cljs
<
2020-09-11
>
AJ Snow04:09:46

has anyone dealt with a stale client? I'm not sure why it decided to start doing this. I've tried restarting everything.

bbss05:09:54

@ajsnow2012 usually this means the browser has an old version

bbss05:09:14

are you sure the cache of your browser is disabled?

bbss05:09:43

i.e. devtools > network tab > disabled cache ticked (don't worry, it will only be disabled while, devtools are open)

AJ Snow18:09:59

I will try this, thanks!

Misha Bohdan07:09:16

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 '' 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.

thheller08:09:54

@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?

AJ Snow04:09:55

I will check this tomorrow and update the channel if I it still happens and/or I fix or whateves

Norman Eckstein08:09:12

Anyone using shadow-cljs with Cursive on Windows?

thheller08:09:38

@bohdan.mikhail looks like shadow-cljs isn't running? or running on a different port but not having compiled yet?

👍 3
Norman Eckstein08:09:01

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

Misha Bohdan08:09:37

@thheller VSCode says that all should works fine, according to logs

shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.11.0 running at 
shadow-cljs - nREPL server started on port 8777

Norman Eckstein08:09:42

I tried to get @jacek.schae project working in Cursive

Misha Bohdan08:09:23

Can it be caused by running under WSL?

Norman Eckstein08:09:23

I use WSL2 but since today I do all coding directly in Windows

pmooser08:09:26

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.

thheller08:09:28

@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

thheller08:09:07

(or forward the port from windows)

Norman Eckstein08:09:11

Sorry mixed up with your discussion 😆

pmooser08:09:07

(maybe :advanced doesn't work with bootstrap, who knows?)

thheller08:09:10

@pmooser :bootstrap does not have that setting at all. :advanced is not compatible with bootstrap, must use :simple

pmooser08:09:57

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)

pmooser08:09:35

That appears not to work at all for me, but thanks for the info.

thheller08:09:53

@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

Norman Eckstein08:09:50

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

Misha Bohdan08:09:13

@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?

thheller09:09:53

hmm how do you access the webpage?

Misha Bohdan19:09:45

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

Norman Eckstein08:09:39

Must be a beginner problem 😐

pmooser08:09:03

@thheller Is the fact that :advanced doesn't work with :bootstrap a shadow-cljs limitation, or a fundamental self-hosted cljs limitation?

thheller08:09:05

fundamental, it cannot work ever anywhere.

thheller08:09:35

@info902 well what DID you try? do you have a hardcoded :nrepl {:port 9000} or so in your shadow-cljs.edn?

pmooser08:09:35

@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?

Norman Eckstein09:09:14

Yeap / :nrepl {:port 333} and npm run dev starts up

Norman Eckstein09:09:00

Damn, I just deleted the whole .idea project and recreated it new. This time directly with the pom.xml

Norman Eckstein09:09:18

Looks better now with Cursive

mauricio.szabo12:09:06

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;
  }
}

mauricio.szabo12:09:46

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?

thheller12:09:40

this pattern isn't supported (ie. require.resolve)

thheller12:09:40

you can set :js-options {:resolve {"canvas" false}} so it won't bundle it

thheller12:09:16

that might kind of work but is rather horrid thing to do

Alexis Vincent14:09:57

@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.

Alexis Vincent14:09:38

But neither is connecting back to the shadow watcher

Alexis Vincent14:09:35

Do they support repl in the browser?

thheller15:09:47

don't use :esm when embedding into other targets. thats needs a lot more work before that becomes practical.

Alexis Vincent15:09:14

Would you suggest using :browser?

thheller15:09:15

:npm-module should work fine *BUT* you need to ensure the REPL ns is loaded from JS

Alexis Vincent15:09:30

right, which ns is this?

thheller15:09:39

so wherever you do (require "./cljs/whatever.your.ns")

thheller15:09:58

the ns is shadow.cljs.devtools.client.browser

thheller15:09:22

you can if if (process.env.NODE_ENV === "development") { require ... } in the JS

thheller15:09:31

don't know what your JS looks like

Alexis Vincent15:09:36

cool. So in dev, load shadow.cljs.devtools.client.browser

Alexis Vincent15:09:39

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

Alexis Vincent15:09:20

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.

Alexis Vincent15:09:47

Thanks for the help!

thheller15:09:39

cljs.core as npm package to be included in other CLJS builds is pretty much a no go

thheller15:09:49

or rather not something I'm interested in working on or supporting

thheller15:09:59

just goes completely against what :advanced is supposed to do