Fork me on GitHub
#shadow-cljs
<
2018-11-09
>
priornix02:11:32

I'm trying to debug a react library react-sortable-hoc https://github.com/clauderic/react-sortable-hoc. I installed it locally using npm install extern/react-sortable-hoc. The package.json file contains the following:

"dependencies": {
    "create-react-class": "^15.6.2",
    "left-pad": "file:extern/left-pad",
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "react-sortable-hoc": "file:extern/react-sortable-hoc"
  }
I have also checked that node_modules/react-sortable-hoc is pointing to the extern/react-sortable-hoc. But when I refer to this library from cljs, the following error appears
[:frontend] Build failure:
The required JS dependency "react-sortable-hoc" is not available, it was required by "sortable/frontend/sortable.cljs".

Searched in:sortable/node_modules
As a test, I git-cloned the left-pad library and installed it locally, but it works.
(:require [reagent.core :as r :refer [atom]]
            [reagent.ratom :refer-macros [reaction]]
            ["react-sortable-hoc" :as rsh]
            ["left-pad" :as lp]

thheller07:11:14

@richiardiandrea shadow-cljs just calls npm install <packages-from-deps-cljs> or yarn add <packages> (if yarn.lock) exists

thheller07:11:51

no idea about .npmrc if that needs an extra flag or something?

thheller07:11:54

@priornix are you sure that there are all the actual files in node_modules/react-sortable-hoc? npm sometimes leaves empty directories (non-linked)

thheller07:11:14

@priornix did you build the react-sortable-hoc? the git repo does not contain the dist files so that may be the problem?

priornix09:11:42

@thheller Thanks, I only ran npm install. Running npm run-scripts build works.

đź‘Ť 4
grumplet10:11:15

This is probably obvious, but I can’t immediately work out how I see or configure or update the clojurescript version that an existing shadow-cljs project depends on? There’s no mention in the package.json, shadow-cljs.edn (or project.clj - I’m using cursive).

thheller11:11:00

@grumplet shadow-cljs has a default version is depends on. I do not recommend changing that.

thheller11:11:27

the latest version depends on 1.10.439

thheller11:11:09

ie. if you update shadow-cljs that will usually update the CLJS version with it

thheller11:11:31

may need manual tweaking in project.clj

grumplet11:11:55

Ah thanks. Just found that the version is listed in https://clojars.org/thheller/shadow-cljs. This wasn’t an immediate need, but I have had reason to change the clojurescript version I depended on in other non-shadow projects, so got to thinking…

thheller11:11:18

shadow-cljs typically depends on the latest release. downgrading may not always be possible. 2.7.0 for example requires 1.10.439+ since there were some breaking changes in the cljs.analyzer (given that breaking changes are quite rare)

Logan Powell13:11:03

I'm getting this in my compiled/released javascript. Does the compiler remove tests that are included as {:test #(assert...)} metadata of a function? If not, I can pull them out. I just liked that I could have my tests right next to my functions...

kenny17:11:22

Just curious, are people still compiling their SASS for their CLJS app in a separate process? Or is there something built-in to shadow-cljs?

thheller17:11:34

@kenny nothing built-in for sass (yet)

thheller17:11:45

@loganpowell asserts are typically elided but that particular way to add tests might not be depending on whether you accessed the var somewhere

Logan Powell17:11:58

Thanks man. I'm moving the tests out of the metadata currently, so I'll let you know

richiardiandrea23:11:14

I am still debugging a problem where the yarn add that Shadow launches is not see my .yarnrc ...

richiardiandrea23:11:42

can it be that environment vars like HOME are not set when the shell with yarn add is launched?