Fork me on GitHub
#shadow-cljs
<
2019-06-18
>
dabrazhe09:06:59

@richiardiandrea How does your serverless yaml look like?

Ahmed Hassan12:06:43

What is difference between (:require ["module-name" :as module-name]) and (:require ["module-name"])? Reference: https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages

Ahmed Hassan12:06:29

Similar one: (:require ["moment" :as moment]) vs (:require ["moment"]).

pyr12:06:34

@thheller thanks for the pointer

thheller12:06:40

@ahmed1hsn (:require ["moment"]) has no alias so you it will be included in the code but you can't reference it

✔️ 4
Dmytro Bunin12:06:20

I have an issue with the building the project in the ci (in docker container). When we build the project it sometimes throws an error

shadow-cljs - dependencies updated
[:app] Compiling ...
IllegalStateException: could not find where to put constant for module goog.structs.map.js
And I am not sure if this is the issue with some gitlab optimizations or with the way we have set up the project. I can reproduce it locally (sometimes), but it is really inconsistent locally and it fixes itself when it breaks like that. We also noticed that removing the .shadow-cljs directory in the pipeline makes this issue happen less often. If anyone can point me in some direction would be cool 🙂

thheller12:06:20

hmm never seen that before. is that an :npm-module build?

thheller13:06:22

hmm not a clue sorry

thheller13:06:40

@dmytro.bunin the only clue I can offer is that that error message is from the part of the code that is supposed to move cljs constants (ie. keywords) to their proper places. in this case it is trying to move into a namespace it isn't supposed to be moved to. dunno why that would happen though since there are no keywords in goog.* code. it might be that there is a keyword where this is the only common dependency which should also never happen because that is supposed to be cljs.core.

thheller13:06:02

maybe you have some bad namespace that use code without actually requiring it?

thheller13:06:30

ie. using (clojure.string/foo ...) in an ns that doesnt have a (:require [clojure.string ...])

Dmytro Bunin13:06:42

wouldn’t it then consistently fail?

thheller13:06:02

I don't know what you failure conditions are

Dmytro Bunin14:06:16

alright, thanks for help, at least there is a direction now to look at

carkh14:06:22

@thheller we've been investigating troubles with the lack of pretty printing of edn in cider's repl with @bozhidar... turns out that the troubles look like shadow-cljs specific

carkh14:06:57

here is what he says about it : You might also open some GitHub issue for @thheller pointing him to https://github.com/nrepl/piggieback/commit/8e0ff8911a1a7ad012dba19d3be6d7c0515d418d and subsequent commits. Changes that had to be done for Piggieback to play well with nREPL 0.6.

carkh14:06:26

it is my understanding that shadow-cljs bypasses piggieback

thheller14:06:10

and what would be the issue?

thheller14:06:46

I really do not have time to debug cider issues currently so I can only provide minor guidance to where to look maybe

carkh14:06:04

they had to make some changes to piggieback that might not have been reflected in your implementation of it

thheller14:06:35

and what would that changes be? that commit just adds some comment AFAICT

thheller14:06:15

;; TODO :printed-value was removed in nREPL 0.6.0

carkh14:06:16

is can see some changes in piggieback.clj, though i couldn't tell what these do at all

carkh14:06:06

mainly the enqueue function i guess

thheller14:06:33

thats irrelevant since shadow-cljs doesn't use it

carkh14:06:42

i wouldn't know =)

thheller14:06:13

I really just need a nrepl message log of how it supposed to be

thheller14:06:22

then diff that with what shadow-cljs sends

carkh14:06:35

i think i can do that

thheller14:06:03

also some nrepl documentation maybe?

carkh14:06:47

i have no knowledge of anything, i can cut/paste the nrepl-messages buffer for shadow-cljs (not pretty printing) and figwheel (pretty printing works)

carkh15:06:11

well that doesn't show anything different, only the printed value has new-lines in it for figwheel and not for shadown-cljs

thheller15:06:39

might be some middleware changes then

thheller15:06:51

please open an issue .. I'll look into it when I have more time

carkh15:06:02

sure thanks

credulous21:06:16

Hi, I’m doing something wrong trying to use a React component but I’m out of ideas. I’m trying to use react-select.

credulous21:06:41

I have this entry in my packages.json: "react-select": ""

credulous21:06:12

It successfully installed and there is a react-select/ directory in node_modules

credulous21:06:43

I have this namespace declaration:

credulous21:06:50

(ns alexandria.views
  (:require 
    ["react-select" :default Select]
    [reagent.core :as r]
    [re-frame.core :as rf]
    [re-frame.db :as db]
    [alexandria.mapbox :refer [mapbox ]]))

credulous21:06:58

But when I eval it I get:

credulous21:06:19

The required JS dependency "react-select" is not available, it was required by "alexandria/views.cljs".

Searched in:/Users/rodfrey/dev/terrapin/alexandria/node_modules

You probably need to run:
  npm install react-select

See: 
fireplace.vim: Something went wrong: {'status': ['done'], 'id': 'fireplace-MacBook-Pro.hitronhub.home-1560792001-475', 'session': ['ef44ac71-4693-4684-91aa-9673224c2965'], 'err': 'The required JS dependency "react-select" is not available, it was required by "alexandria/views.cljs".^@^@Se
arched in:/Users/rodfrey/dev/terrapin/alexandria/node_modules^@^@You probably need to run:^@  npm install react-select^@^@See: 

thheller21:06:33

you can't just point at a git repo and expect that to work

thheller21:06:46

that package most likely has its own build step

credulous21:06:53

The maintainer of that package says to import it using import Select from 'react-select';

credulous21:06:30

OK I thought it built correctly but I’ll go back and double check

thheller21:06:28

thats the file you'd get from the direct npm package

thheller21:06:42

it doesn't exist in the git repo (and neither do the other files)

thheller21:06:03

why do you need the git repo? why not just npm install the regular package?

credulous21:06:38

Because I was being a moron - npm i react-select failed and the author seems to only use yarn. In any event, I changed the package.json entry to "react-select": "^3.0.4" and cleaned everything out and did npm install

credulous21:06:11

Again there’s a react-select directory in node_modules. But I get the same error.

thheller21:06:34

/Users/rodfrey/dev/terrapin/alexandria/node_modules/react-select?

credulous21:06:43

Sorry for the git:// red herring

thheller21:06:00

make sure its not empty. npm sometimes acts funky and leaves empty directories

credulous21:06:28

[email protected]: ~/dev/terrapin/alexandria $> ls /Users/rodfrey/dev/terrapin/alexandria/node_modules/react-select/
total 176
-rw-r--r--   1 rodfrey  staff   5.3K Oct 26  1985 README.md
-rw-r--r--   1 rodfrey  staff    75K Oct 26  1985 CHANGELOG.md
drwxr-xr-x   4 rodfrey  staff   128B Jun 18 15:15 animated
drwxr-xr-x   4 rodfrey  staff   128B Jun 18 15:15 async-creatable
drwxr-xr-x   4 rodfrey  staff   128B Jun 18 15:15 async
drwxr-xr-x   4 rodfrey  staff   128B Jun 18 15:15 base
drwxr-xr-x   4 rodfrey  staff   128B Jun 18 15:15 creatable
drwxr-xr-x  25 rodfrey  staff   800B Jun 18 15:15 dist
drwxr-xr-x  21 rodfrey  staff   672B Jun 18 15:15 src
-rw-r--r--   1 rodfrey  staff   2.5K Jun 18 15:15 package.json
drwxr-xr-x  12 rodfrey  staff   384B Jun 18 15:15 .
drwxr-xr-x  72 rodfrey  staff   2.3K Jun 18 15:15 ..

credulous21:06:06

the dist folder is full’o’code too.

thheller21:06:46

did you try restarting the process? it sometimes gets confused if you mess with node_modules too much

credulous21:06:49

Restarted shadow-cljs server:

credulous21:06:52

[email protected]: ~/dev/terrapin/alexandria $> shadow-cljs watch alexandria
shadow-cljs - config: /Users/rodfrey/dev/terrapin/alexandria/shadow-cljs.edn  cli version: 2.8.37  node: v11.5.0
shadow-cljs - connected to server
shadow-cljs - watching build :alexandria
[:alexandria] Configuring build.
[:alexandria] Compiling ...
[:alexandria] Build failure:
The required JS dependency "react-select" is not available, it was required by "alexandria/views.cljs".

Searched in:/Users/rodfrey/dev/terrapin/alexandria/node_modules

You probably need to run:
  npm install react-select

thheller21:06:07

thats not a restart. notice the shadow-cljs - connected to server

credulous21:06:10

oh wait, I have a background server, I forgot I did that

credulous21:06:48

That was it. Thanks, I feel like a buffoon, but at least I’m a buffoon who’s moving forward

haywood21:06:40

anyone ever seen an issue during development where the JS console outputs a lot of googl.string.isNumeric is not a function and other seemingly Google Closure issues. The issue is resolved when building for production

haywood21:06:54

the network tab shows the myriad of JS dependencies have resolved

thheller21:06:41

googl? that shoul be goog?

haywood21:06:01

this was seen on a co-workers machine who doesn’t normally run this project. we ruled out a lot of differences between our environments, mostly just Node versions, since everything else is declared in project.clj/package.json.

haywood21:06:08

Yea, I miss-typed

thheller21:06:57

project.clj might install a conflicting closure-library version?

thheller21:06:11

although it should be doing that everywhere

thheller21:06:25

check for conflicts lein deps :tree

thheller21:06:51

should be

[com.google.javascript/closure-compiler-unshaded "v20190325"]
   [org.clojure/google-closure-library "0.0-20190213-2033d5d9"]

haywood22:06:19

hm, yea it’s in there. Also odd that compiling a production bundle works

thheller22:06:10

are you sure the correct files are getting loaded? maybe bad cache or so