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

Klipse cannot be built with shadow-cljs #353

Open strontian opened 4 years ago

strontian commented 4 years ago

Trying to build a project with shadow-cljs when klipse is a dependency causes this error:

Externs must contain builtin for env BROWSER: whatwg_console.js

See below:

https://github.com/thheller/shadow-cljs/issues/615

viebel commented 4 years ago

I am aware of this issue. Feel free to open a PR that makes Klipse compatible with shadow-cljs

workshub[bot] commented 4 years ago

This issue is now published on WorksHub. If you would like to work on this issue you can start work on the WorksHub Issue Details page.

workshub[bot] commented 4 years ago

If you successfully complete this Issue via WorskHub there's a $180 reward available. Start work via WorksHub Issue Details page.

workshub[bot] commented 4 years ago

A user started working on this issue via WorksHub.

Bost commented 4 years ago

I think the "culprit" is the commit https://github.com/clojure/clojurescript/commit/c1cf559a74760436babe016b9bae55b70b5c8495#diff-0333a2f6436dc06f1d021fa4c2ac5525L51 more specifically the missing (:infer-externs options)

This helps https://github.com/Bost/clojurescript/commit/3ae53198837813c7eb2707402d43c358f7299152

BTW I analysed the problem using the https://gitlab.com/viebel/clojurescript-reagent-klipse-demo and found out it may have something to do with leiningen: clojure -m figwheel.main works but when you run it with lein fig using the project.clj below it does not.

(defproject clojurescript-reagent-klipse-demo
  "0.0.0"

  :description ""
  :url ""
  :license {:name "Eclipse Public License v1.0"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies
  [
   [org.clojure/clojure
    #_"1.10.0"
    "1.10.1"
    ]
   [org.clojure/clojurescript
    "1.10.782" ;; Upgrade to closure-compiler-unshaded "v20200614"

    ;; "1.10.773" ;; latest - bad
    ;; "1.10.764"
    ;; "1.10.758"
    ;; "1.10.756"
    ;; "1.10.753"
    ;; "1.10.748"
    ;; "1.10.742" ;; bad
    ;; "1.10.741"
    ;; "1.10.740"
    ;; "1.10.739" ;; bad
    ;; "1.10.738" ;; bad
    ;; "1.10.720" ;; bad custom build
    ;; "1.10.719" ;; good custom build
    ;; "1.10.717" ;; good custom build
    ;; "1.10.715" ;; good custom build
    ;; "1.10.711" ;; good custom build
    ;; "1.10.702" ;; good custom build
    ;; "1.10.667" ;; good custom build
    ;; "1.10.597" ;; good with warn
    ;; "1.10.520" ;; good with warn
    ]

   [viebel/klipse "7.9.6"] ;; latest

   ;; [reagent "0.10.0"]
   ;; [reagent-utils "0.3.3"]
   ;; [cljs-ajax "0.8.0"]
   ;; [pez/clerk "1.0.0"]
   ;; [metosin/reitit "0.5.2"]
   ;; [venantius/accountant "0.2.5"]

   ;; [devcards "0.2.7"]
   [com.bhauman/figwheel-main "0.2.9"]
   ;; [cider/piggieback "0.5.0"]
   ;; [com.bhauman/rebel-readline-cljs "0.1.4"]

   ]

  ;; :source-paths ["src"]
  ;; setup target as a resource path
  :resource-paths ["target" "resources"]
  ;; set up an alias to invoke your figwheel build
  :aliases {"fig" ["trampoline" "run" "-m" "figwheel.main"]
            "build-dev" ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"]}
  )
workshub[bot] commented 4 years ago

@Bost started working on this issue via WorksHub.

workshub[bot] commented 3 years ago

@irynadunets started working on this issue via WorksHub.

wilkerlucio commented 3 years ago

I'm having a different issue, when I try to build with Shadow I get:

The required namespace "cljsjs.codemirror.addon.edit.matchbrackets" is not available, it was required by "klipse/ui/editors/editor.cljs".

This one seems simpler, some cljsjs stubs could fix it, has someone done this part? Or know if the current status is different?

Bost commented 3 years ago

Or know if the current status is different?

I've got no reaction to my findings so I sorta abandoned this klipse project. ¯\_(ツ)_/¯

viebel commented 3 years ago

No, noe @Bost . Please don't abandon Klipse. I'll try to address your comments soon.

viebel commented 3 years ago

Compiling Klipse with shadow-cljs requires extra care as it involves self-hosted (bootstrapped) ClojureScript. First step would be to be able to complile klipse-clj with shadow-cljs. There is a piece in shadow-cljs that explains how to compile code that involves self-hosted ClojureScript.

cjqw commented 3 years ago

Meet the same issue with figwheel.

workshub[bot] commented 3 years ago

A user started working on this issue via WorksHub.

workshub[bot] commented 2 years ago

@ZabelTech started working on this issue via WorksHub.