Fork me on GitHub
#clojurescript
<
2021-07-12
>
ChillPillzKillzBillz11:07:45

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)

p-himik11:07:46

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
ChillPillzKillzBillz11:07:13

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

sova-soars-the-sora16:07:46

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

sova-soars-the-sora16:07:44

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

thheller16:07:27

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

thheller16:07:37

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

ChillPillzKillzBillz19:07:38

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

sova-soars-the-sora22:07:18

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.

ChillPillzKillzBillz14:07:17

has anyone combined shadow-cljs with figwheel?

p-himik14:07:53

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

p-himik14:07:53

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

ChillPillzKillzBillz14:07:52

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!!

zendevil.eth21:07:12

I’m running the following test

(ns humboi.core-test
  (:require [cljs.test :refer-macros [is are deftest testing use-fixtures]]
            [pjstadig.humane-test-output]
            [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 />
<body>
  <div>
    <div>
      <p>
        Something
      </p>
    </div>
  </div>
</body>]

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

3