Fork me on GitHub

I am reposting from my figwheel threads... Hi, I have a deps.edn build configuration as follows:

:aliases {:fig {:extra-deps
                  {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
                   com.bhauman/figwheel-main {:mvn/version "0.2.11"}}
                 :extra-paths ["target" "test"]}
           :build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}
           :min   {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]}
           :test  {:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" "smiley-cljs.test-runner"]}}}
The run through `clj -M:fig:build` is successful. But when I try to run `clj -M:fig:min` I get the following error:
[Figwheel] Failed to compile build dev in 9.241 seconds.
[Figwheel:WARNING] Compile Exception: Illegal char <:> at index 2: /H:/Work/Clojure/smiley/target/public/cljs-out/dev/cljs/core.js  
[Figwheel:SEVERE] Illegal char <:> at index 2: /H:/Work/Clojure/smiley/target/public/cljs-out/dev/cljs/core.js
How can the build version compile but the minification doesn't work? Also what is the correct way to deploy a figwheel clojurescript project such that the clojurescript script is not visible in production environment? (edited)


Please avoid reposting, unless a noticeable amount of time has passed (many hours, given that we're all in different time zones) and you haven't gotten any reaction.

👍 2

I did this because there appears to be no activity in figwheel threads


Hmm that bites that the minification ain’t working. I have been using shadow-cljs for a bit now, might recommend looking into that.


You can try cleaning targets before you minify, that might help if it’s trying to use non-mini code to generate the end-product JS


pretty sure there is an open issue about this in CLJS Jira


at least there was, no clue if that ever got fixed


In general what is the process for creating a production ready js such that the CLJS script is not published?


If you’re using shadow-cljs there is a release build you can start by changing watch to release in the invokation. shadow-cljs release app If you’re using figwheel I think it’s lein cljsbuild once min or at least that’s what I was doing if memory serves.


has anyone combined shadow-cljs with figwheel?


They do the same thing but differently. Why would you want to combine them?


You can combine lein and shadow-cljs. But personally, I don't like that approach.


In case anybody is still interested... I fixed it!! In case anybody wants to know... this core.js file is autogenerated... however if it already exists... it'll have this 1st line "// compiled".... To build with the min configuration, all that is needed is to delete this line... the build process puts the line back... but the build doesn't fail!! Riddle me that!! 😄 I am happy I can build!!


I’m running the following test

(ns humboi.core-test
  (:require [cljs.test :refer-macros [is are deftest testing use-fixtures]]
            [reagent.core :as r :refer [atom]]
            #_[humboi.core :as rc]
            ["jsdom-global/register" :as jsdom]
            ["@testing-library/react" :refer [render fireEvent waitFor screen]]))

(deftest test-home
  (render (r/as-element [:div [:p "Something"]]))
  (.click fireEvent (.getByText screen "Something!"))
  (is (= "Something" (.getByText screen "Something")))
And upon running the tests it gives:
ERROR in (test-home) (TestingLibraryElementError:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
  actual: #object[Error TestingLibraryElementError: Unable to find an element with the text: Something!. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, <script />, <style />

Ran 1 tests containing 1 assertions.
0 failures, 1 errors.