Fork me on GitHub
#shadow-cljs
<
2017-10-28
>
dimovich08:10:00

how does shadow-cljs deal with local maven packages? While boot picks it up ok, shadow-cljs complains it cannot find the package in maven

thheller08:10:50

hmm does boot have repository config for them?

dimovich08:10:35

not really, I took cljsjs.fabric from the official repo, and modified it, then run boot package to install it to local maven

thheller08:10:57

or a plugin of some kind? I’m using https://github.com/cemerick/pomegranate which I think boot uses too?

thheller08:10:45

that should work? did you restart the process?

thheller08:10:19

but why use cljsjs? the point is to get rid of those 😉

thheller08:10:25

just npm install fabric and (:require ["fabric" :as fabric])

dimovich08:10:35

yeah I restarted the process... I'm using cljsjs.fabric because there are some issues with using it directly from npm (can't find jsdom)

dimovich08:10:18

thanks for pomegranate suggestion, will try it

thheller08:10:43

I wanna hear about all packages that don’t work

thheller08:10:46

so I can fix it 🙂

dimovich08:10:05

oh, that would be great 🙂

thheller08:10:26

pomegrenate is what shadow-cljs uses to resolve deps

thheller08:10:33

you don’t use it directly 🙂

thheller08:10:40

looking into the jsdom thing

dimovich08:10:50

I've tried using fabric directly also using boot, but no success... same issue

thheller08:10:45

ok found the problem, fixing

dimovich08:10:52

hoho... we need to 3d print a superhero badge for you 🙂

thheller08:10:37

please report all packages that fail to import properly, that actually revealed two issues. the important one is fixed 😉

dimovich09:10:41

great, it compiles ok now. checking if the app is running ok

dimovich09:10:20

how comes shadow-cljs can compile things that the official compiler can't?

dimovich09:10:36

where was the issue?

thheller09:10:05

it doesn’t try to compile things via the closure compiler :advanced

thheller09:10:17

it just bundles the code like webpack or any other js tool would

thheller09:10:34

and only does :simple … also similar to what uglifyjs or so would do

thheller09:10:22

the issue is that some npm packages “disable” certain requires via “browser” overrides in package.json

thheller09:10:40

so jsdom shouldn’t have been included but the override didn’t trigger correctly

dimovich09:10:35

btw, you mentioned shadow.cljs.devtools.api... how can I use it from a boot script? It's cljs, right?

dimovich09:10:14

in boot there is a call task (call :eval (...))

thheller09:10:24

no its clojure, just call it

thheller09:10:35

I’m really do not know much about boot in a clojure REPL you’d just (require 'shadow.cljs.devtools.api) (shadow.cljs.devtools.api/compile :foo)

thheller09:10:44

+ aliases if you wanted

thheller09:10:05

I suppose boot can do that somehow, I never understand how there task system works exactly

dimovich09:10:47

I also need to provide externs for every module I use?

thheller09:10:36

externs are generated for all included JS but its not 100% accurate

thheller09:10:12

working on some further externs inference currently

thheller09:10:22

but yeah … sometimes you’ll need externs

thheller11:10:28

I do not know anything about boot .. does boot install when you release something or not?

thheller11:10:43

into the local maven repo that is

thheller11:10:50

lein deploy does not do that, only lein install

Jon11:10:15

oh, right...

Jon11:10:40

I use boot deploy, probably not calling (install)

dimovich11:10:15

I'm getting Uncaught ReferenceError: process is not defined when trying to load the js

thheller11:10:38

loading which js?

Jon11:10:40

paste code?

thheller11:10:02

just need to know which package is causing the issue, shadow-cljs release app --source-maps should help track it down

thheller11:10:57

@dimovich [email protected] should fix the process issue and make it easier to track problems by printing the name of the thing that failed to execute in the console

dimovich12:10:28

@thheller trying now with the new version and source-maps

dimovich12:10:38

when using fabric (:require ["fabric" :as fabric :refer (Canvas IText Image)])

dimovich12:10:52

if I remove the fabric dependency it works ok

thheller14:10:43

fabric is one scary package

thheller14:10:49

well its dependencies are 🙂

thheller14:10:15

ok, the problem is that non of this should be required in the first place

thheller14:10:31

second part of the problem is the cyclic dependency

thheller14:10:47

I’m not yet sure how to fix this

thheller14:10:09

if you scroll down there is a

thheller14:10:27

(function() {

  if (typeof document !== 'undefined' && typeof window !== 'undefined') {
    return;
  }

thheller14:10:08

meaning that everything that follows will not be executed … but that doesn’t quite work since my bundler doesn’t understand the if

thheller14:10:23

need to think about how to fix that

thheller15:10:05

I wonder how webpack handles this

thheller15:10:35

I can fix it so it doesn’t error out but it will still include the http dependency although it shouldnt

thheller15:10:54

super weird package .. thx for bringing it to my attention I guess

thheller15:10:53

browserify also bundles the stuff it shouldn’t

thheller15:10:08

so does webpack …

thheller15:10:14

how has no on complained about this before?

thheller15:10:12

well I guess I can then do the same as webpack and browserify …

thheller16:10:02

[email protected] now behaves like webpack would … 34kb overhead until the above issue is fixed