viebel / klipse

Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
http://blog.klipse.tech/
GNU General Public License v3.0
3.1k stars 153 forks source link

new issue with reagent, and loading namespaces? #383

Closed postylem closed 3 years ago

postylem commented 3 years ago

I have been using Klipse for interactive clojure codeboxes on a couple different sites (thank you for making it!). I recently (yesterday) noticed two new issues (which might be related). I have a simple codebox at the top of every page, which makes a namespace and specifies some dependencies, like

(ns my.ns
  (:require [reagent.core :as r] ; for some functions I want to define using reagent
            [clojure.zip :as z] ; etc, from Clojure's Core Library
            ))

Up until recently, this worked beautifully, and I could define functions in the clojure boxes (which would live in namespace my.ns), and use tools from reagent.core as well.

Yesterday I noticed two things were different on both sites that I'm using this on, simultaneously (I hadn't modified anything on the sites, so I think it must be due to some external change (I've also noticed similar problems seem to be happening on other sites, including even posts on blog.klipse.tech and here and here))

  1. When the page first loads, it doesn't seem to have loaded the namespace, and all the codeboxes that finish with a function defitition show that the ns is 'cljs.user instead of 'my.ns. The namespace code above gives the error: load-ns-from-file: cannot fetch https://viebel.github.io/klipse-clj/target/public/cljs-out/dev//cljs/core$macros.cljc.cache.json.
  2. Reagent is no longer available (I get the No such namespace: reagent.core error when trying to :require reagent.core). If I remove reagent.core from the require map, problem 1 remains upon the first load of the page, however, in this case, if I reëvaluate any of the code boxes, they seem to function fine: the namespace is my.ns, and I can use things from zip like 'z/node' (but then I can't use reagent, of course).

Has something recently changed in how namespaces and dependencies are loaded?

postylem commented 3 years ago

I think it might be due to the CORS issue that was just mentioned in issue #382.

Screen Shot 2020-09-28 at 14 11 57
viebel commented 3 years ago

That is due to the same issue as #382 Should be fixed now.