Fork me on GitHub
#shadow-cljs
<
2019-06-06
>
thheller07:06:53

@devo could you be a bit more specific? what exactly is your issue?

thheller07:06:34

util and stream are among the packages that have automatic browser polyfills so I'm not exactly sure what you are asking?

devo14:06:30

sorry, my issue was that I had to be explicit about how to resolve those in the shadow-cljs.edn file. i.e.

:js-options {:js-provider :shadow
                              :resolve
                              {"process"
                               {:target :global
                                :global "window.process"}
                               "util"
                               {:target :global
                                :global "window.util"}
                               "stream"
                               {:target :global
                                :global "window.stream"}
                               "buffer"
                               {:target :global
                                :global "window.buffer"}
                               "string_decoder"
                               {:target :global
                                :global "window.string_decoder"}
                               "events"
                               {:target :global
                                :global "window.events"}
                               "crypto"
                               {:target :global
                                :global "window.crypto"}
                               "querystring"
                               {:target :global
                                :global "window.querystring"}
                               "url"
                               {:target :global
                                :global "window.url"}}}

thheller14:06:57

no. that config is entirely unnecessary

thheller14:06:12

it should not be needed at all

4
thheller14:06:57

remove the :resolve completely and tell me the error you get 😛

👍 4
devo14:06:37

C:\Users\Devo\source\repos\compiler_repro>npx shadow-cljs compile main
shadow-cljs - config: C:\Users\Devo\source\repos\compiler_repro\shadow-cljs.edn  cli version: 2.8.39  node: v10.5.0
WARNING: The thheller/shadow-cljs dependency in shadow-cljs.edn was ignored. Default version is used and override is not allowed to ensure compatibility.
[:main] Compiling ...
The required JS dependency "process" is not available, it was required by "node_modules/prop-types/checkPropTypes.js".

Searched in:C:\Users\Devo\source\repos\compiler_repro\node_modules

You probably need to run:
  npm install process

See: 

thheller14:06:55

right. I assume you are just missing the shadow-cljs dependency in the project

thheller14:06:18

ie. no shadow-cljs in your package.json

devo14:06:33

oh shoot 😅

thheller14:06:52

it brings in the node-libs-browser dep which is missing here

devo14:06:50

thanks! That worked! Now I just need to figure out the closure exceptions I'm seeing. Is there an easy way to work around closure exceptions in dependencies? error itself

[:main] Compiling ...
Closure compilation failed with 1 errors
--- node_modules/n3/lib/N3DataFactory.js:45
Multiple classes cannot share the same name.

thheller16:06:53

hmm yeah dunno what that one is about

👍 4
mhuebert08:06:20

hm, possible bug with module-spitting. in an advanced build I’m seeing the error:

ReferenceError: $cljs$cst$keyword$pro_SLASH_review$$ is not defined
the :pro/review keyword is also used in another module. if I rename that keyword (in the other module), then this error goes away and I get the same error with another similarly-used keyword.

mhuebert08:06:12

i can try to make an isolated repro

mhuebert08:06:39

not sure if it is shadow-specific in any way

thheller08:06:18

@mhuebert this can happen if you module dependencies aren't configured "correctly"

mhuebert08:06:01

ok. when listing :depends-on, do you have to list all the transitive dependencies?

thheller08:06:24

I thought that was implicit but it isn't for some reason

mhuebert08:06:26

ah. i wasn’t doing that. maybe thats the issue.

thheller08:06:36

didn't have time to look into that in detail yet

thheller08:06:48

that linked CLJS issue is not a problem in shadow-cljs

thheller08:06:15

the problem you see can also happen if you "share" build outputs from different build passes

thheller08:06:29

so make sure that all files you load belong to the same build

thheller08:06:42

(you had the problem with 2 builds in one output-dir before IIRC)

mhuebert08:06:10

yeah. this project has only one build, and i’ve tried to keep those out-dirs separate now 🙂

thheller09:06:53

also make sure you are loading things in the correct order

mhuebert09:06:31

i think i had mistakenly listed a module that I am lazy-loading, as a :depends-on of my root module

mhuebert09:06:47

so then the root modules assumes “hey this exists”

mhuebert09:06:02

when i actually only load it later

thheller09:06:03

might be yeah

mhuebert09:06:22

i had a confused mental model of how to put this stuff together

mhuebert09:06:11

the manual-listing-of-transitive-dependencies, is that from cljs proper

thheller09:06:58

from the Closure Compiler kind of

thheller09:06:49

but should be easy to fix in shadow-cljs

thheller09:06:08

just always assumed that closure would do this automatically

mhuebert09:06:59

yeah i would have thought so too. seems obvious

thheller09:06:18

to be fair the constant extraction code is from me

thheller09:06:29

so it sort of could be blamed on me

thheller09:06:20

that code does seem to need to full transitive deps

mhuebert09:06:30

so we’d need to do a pass over the module config to build up the graph?

thheller09:06:10

something that populates :depends-on yes

thheller09:06:51

hmm nah .. probably enough in the JSModule construction code

thheller09:06:08

if you open an issue I'll take care of it later

4
Ahmed Hassan10:06:09

When I run node script.js it gives following error. I've puppeteer in package.json and installed with npm install.

thheller10:06:26

where is the rest of the error ...

thheller10:06:37

there should be a stacktrace with the actual error

thheller11:06:07

and the package is properly installed in the directory of script.js? ie. /home/maverick/Desktop/automat/node_modules/puppeteer?

👍 4
thheller11:06:30

Error: Cannot find module 'puppeteer' thats the node error for missing packages

👍 4
Ahmed Hassan11:06:31

Thanks. I had installed puppeteer-core but was requiring puppeteer.

metacritical15:06:53

Can i bundle a cljs lib i created in shadow-cljs as a jar?

thheller16:06:02

shadow-cljs currently has no support for creating jars no

thheller16:06:15

I'd recommend lein

metacritical17:06:12

@thheller Aah, i thought there is something missing in the docs. Thanks though!

knubie18:06:59

I’m trying to add a new build to my config but getting this error when running the compiled js file: Uncaught Error: browser bootstrap used in incorrect target

knubie18:06:22

it’s just a simple file that runs (js/console.log "foo") any one know what causes this error?

knubie18:06:15

Config looks like this.

knubie18:06:28

I’m requiring it in my main js file as a worker, so maybe that has something to do with it

knubie18:06:55

oh, nevermind, just saw that there is a worker section in the docs

knubie18:06:03

i’ll have a look at that

Drew Verlee19:06:20

cloned and followed the instructions here https://github.com/thheller/reagent-expo. When i tried to run cider-connect-cljs w/ shadow i got a java.lang.RuntimeException "Invalid token: :" any ideas where to start?

thheller20:06:05

@j.lum07 that should be fixed in 2.8.39?

thheller20:06:38

@drewverlee I don't use emacs so no clue what that means ... having a full stacktrace would be useful?

thheller21:06:54

is there any clue about what it is trying to read?

thheller21:06:12

make sure you have the proper cider-nrepl versions and so on

thheller21:06:22

I really don't know enough about emacs to be of much help

Drew Verlee01:06:11

ah ok thanks.

Justin21:06:04

That worked! Thanks @thheller!