Fork me on GitHub
#shadow-cljs
<
2020-01-26
>
dpsutton07:01:16

I'm trying to switch my work app from a figwheel app to shadow. I'm partway there but i seem to be blowing up, lots of warnings failed to load re_frame.events.js Error: No protocol method IMapEntry.-key defined for type object: [object Object]. The websocket connects and then immediately says that it cannot parse the message. It seems almost that cljs isn't well defined

dpsutton07:01:30

all of the warnings happen before the websocket notification.

dpsutton07:01:25

things seem to be compiling. resources/public/js/main.js is output. our custom backend is serving resources/public and i have an asset path of "/js"

thheller09:01:20

@dpsutton likely very old versions of some libraries that incompatible with the CLJS release

thheller09:01:17

IMapEntry.-key is a common error for libs that used to call key on vectors which used to work but no longer

Kamuela13:01:19

;; shadow-cljs configuration
{:source-paths
 ["src/dev"
  "src/main"
  "src/test"]

 :dependencies
 [reagent "0.9.1"]

 :dev-http {8080 "public"}

 :builds
 {:frontend
  {:target :browser
   :modules {:main {:init-fn }}}}}
And I get
shadow-cljs - config: /Users/kamuela/Code/acme-app/shadow-cljs.edn  cli version: 2.8.83  node: v12.14.1
===== ERROR =================
reagent is not ISeqable
=============================
when I try to run shadow-cljs watch frontend Top of app.cljs:
(ns 
  :require [reagent.core :as r])

thheller13:01:38

thats invalid

thheller13:01:57

(ns 
  (:require [reagent.core :as r]))

4
Kamuela13:01:42

Hmm, I still seem to get the same error with

(ns 
  (:require [reagent.core :as r]))

thheller14:01:37

kinda hard to say what you are doing. that ===== ERROR ======= bit comes from the shadow-cljs command line. so not even the compiler

thheller14:01:45

what are you doing exactly?

thheller14:01:23

oh wait .. now I see it

thheller14:01:28

your config is also incorrect 😛

thheller14:01:39

:dependencies
 [[reagent "0.9.1"]]

thheller14:01:28

guess that should be validated better

Kamuela15:01:11

That did fix it

dpsutton21:01:51

solved my woes. seems schema was doing shenanigans with mapentry. I dont' entirely understand what was going on but bumping this solved my woes. https://github.com/plumatic/schema/pull/393

dpsutton21:01:05

i'm trying to use waypoints.js. Its an IIFE that sets window.Waypoint = Waypoint. There seems to be no export or anything so when i try to add a require to "waypoints" shadow is recommending me to npm install waypoints which i've already done. Is there a way to "import" this and then use it like js/Waypoint. ?

thheller21:01:43

is that supposed to be a npm package?

thheller21:01:22

that package doesn't follow any package rules whatsoever

thheller21:01:40

looks like its a jquery plugin of the pre-webpack days

dpsutton21:01:10

yeah it seems pretty crazy. it's just establishes it is taking over the global Waypoint binding and that's it.

thheller21:01:05

you can still require it. the package just doesn't contain the proper settings. so shadow-cljs can't tell which file to include

thheller21:01:16

there is no default index.js or main entry in package.json

thheller21:01:30

so you probably need to find the file you need

thheller21:01:48

(:require ["waypoints/foo/bar/something.js"]) and then access via js/Waypoint

thheller21:01:00

or use a library thats actually sane

dpsutton21:01:09

waypoints/lib/noframework.waypoints.min.js

dpsutton21:01:44

do i need to set some compiler setting reassuring that js/Waypoint will exist? Can't image that's statically known

thheller21:01:35

shadow-cljs doesn't know where js/Waypoint comes from and doesn't care either

thheller21:01:53

you just can't reference the exports in the require since it doesn't have any

dpsutton21:01:15

ok. didn't know if it tried to figure out anything about js/Waypoint

dpsutton21:01:22

i think i'm close to having our app moved from lein-figwheel. thanks so much for your tremendous work

royalaid21:01:06

@thheller is there a way for me to tell shadow to look for a package.json in a subfolder?

royalaid21:01:31

Or if I can tell shadow where the deps.edn file is?

royalaid21:01:54

I am trying to work around behavior in Cursive which requires module definitions to basically be defined with the folder name and Cursive will overwrite the modules when re-importing

royalaid21:01:20

and because of how https://aws-amplify.github.io/ organizes its AWS Lambda fn's I have to have a specific folder structure inside the lambdas

royalaid21:01:03

See this image for a high level view

royalaid21:01:08

Ideally I could move the shadow-cljs.edn and deps.edn files up one level and that would "magically" fix a lot

royalaid21:01:32

but I get if shadow can't do that because it makes assumptions about where the package.json is