oakes / Nightlight

An embedded editor for Clojure
https://sekao.net/nightlight/
The Unlicense
788 stars 35 forks source link

Can't get CLJS REPL working #46

Closed hswick closed 6 years ago

hswick commented 6 years ago

Hi, I tried using the clojurescript repl as outlined in the documentation and I was having a bit of trouble. I could run boot run and then get to the cljs repl page. After pressing start button, the repl wasn't printing anything. And the app said "Not Found".

Here is my build.boot

(set-env!
  :resource-paths #{"src"}
  :dependencies '[[org.clojure/clojure "1.9.0-alpha15"]
                  [pandeiro/boot-http "0.8.3" :scope "test"]
                  [adzerk/boot-cljs "1.7.48-5"]
                  [adzerk/boot-reload "0.5.2"]
                  [org.clojure/clojurescript "1.9.946"]
                  [nightlight "1.9.2" :scope "test"]
                  [cljs-web3 "0.19.0-0-7"]])

(require
  '[nightlight.boot :refer [nightlight]]
  '[pandeiro.boot-http :refer [serve]]
  '[adzerk.boot-reload :refer [reload]]
  '[adzerk.boot-cljs :refer [cljs]]
  'web3-test.core)

(deftask night []
  (comp
    (wait)
    (nightlight :port 4000)))

(deftask run []
  (comp
    (serve :dir "target/public" :port 3000)
    (watch)
    (reload)
    (cljs :source-map true :optimizations :none)
    (target)
    (nightlight :port 4000 :url "http://localhost:3000")))

I reated a src/web3_test/core.cljs file that looks like this. This could be wrong as I was sort of confused by this.

(ns web3-test.core
  (:require [nightlight.repl-server]))
oakes commented 6 years ago

There should no longer be a "Start" button in 1.9.2. I'm guessing you need to do a force refresh to kill whatever is cached in your browser. Please try that and let me know if you still have a problem.

hswick commented 6 years ago

Okay yeah the old version was a mistake on my part. I always forget about the browser cache.

But I still seem to have the issue with the REPL. It is very likely I'm missing a config step.

oakes commented 6 years ago

Can I see your main.cljs.edn file?

hswick commented 6 years ago

Don't have one lol. What is it supposed to look like?

I'll make a boot template for this once I get it running.

oakes commented 6 years ago

It's required for boot-cljs. You can put it anywhere in your resources folder. Here's an example:

https://github.com/oakes/full-stack-boot-example/blob/master/resources/public/main.cljs.edn

That file will include your core namespace, thus telling boot-cljs where to start when compiling. If you want an easy way to start a project, go to Nightcoders.net. Log in and create a web app, then click the "Export" button. It will download a fully functional boot project in a zip file, with Nightlight already configured.

oakes commented 6 years ago

I'll close this ticket but let me know if you need any more help.

oakes commented 6 years ago

Did that work for you?

hswick commented 6 years ago

Yes mostly, nightcode.net seems really great. I was having an issue with requiring dependency in the repl though, I posted it in the #nightlight slack

azureus89 commented 4 years ago

@hswick what did you do exactly, I seem to be having the same problem

oakes commented 4 years ago

Hey azureus, what problem specifically? Do you mean the iframe doesn't load anything when you select clojurescript repl from the sidebar?