Fork me on GitHub
#shadow-cljs
<
2019-12-18
>
thheller00:12:45

in what context? I use it sometimes to make externs inference shut up

4
mikerod06:12:49

Just wasn’t sure what it was for. Saw it mentioned in the guide and saw it in a few projects

mikerod06:12:18

Just makes false positive warnings not show up then?

cfleming08:12:11

I have an autotest build config that looks like this:

:test
                {:target    :node-test
                 :output-to "target/test/node-tests.js"
                 :autorun   true
                 :ns-regexp "-test$"}

cfleming08:12:38

However shadow-cljs watch test doesn’t actually run the tests:

~/d/c/lambda (master)> shadow-cljs watch test
shadow-cljs - config: /Users/colin/dev/cursive-site/lambda/shadow-cljs.edn  cli version: 2.8.77  node: v12.1.0
shadow-cljs - connected to server
shadow-cljs - watching build :test
[:test] Configuring build.
[:test] Compiling ...
[:test] Build completed. (115 files, 13 compiled, 0 warnings, 7.68s)

cfleming08:12:00

If I ctrl-c the watch process and manually run the test script, the tests execute correctly. Is there something I’m missing here? Should I be able to watch two builds from the same project simultaneously in separate terminals?

cfleming08:12:05

Oh, actually here’s what’s happening: I have another build from the same project I’m watching in another terminal. The tests are being run in that terminal, not the test one.

thheller10:12:52

yeah I think there is an open issue about that. keep forgetting to change that.

danielneal12:12:23

hey, anyone got any tips or pointers on setting up intellij with shadow-cljs. I use emacs, but I have a co-worker on Intellij just trying to get him up and running.

danielneal12:12:57

Do we need to make a dummy project.clj or something along those lines?

lecross13:12:59

Hi, did you ha a look at that section in the docs ? 😄 https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration

lecross13:12:09

i guess you’ll have to generate the pom.xml and import the project in intellij

lecross13:12:48

if you use cursive you’ll find guides in the docs here https://cursive-ide.com/userguide/leiningen.html

superstructor13:12:30

shadow-cljs is an outstanding compiler etc to use as a library, but lein is just a much more robust build tool and you also get wider compatibility (e.g. Cursive).

thheller13:12:21

I absolutely disagree. leiningen does jack shit for CLJS. it only makes sense for CLJ. it isn't even great for hybrid projects. a big chunk of problems people report are due to "mixing" CLJ and CLJS projects.

danielneal14:12:53

It turns out that it was actually working for my colleague off the bat, and he hadn’t realised! We were so sure we would have to do something fiddly 😄 😄 😄

thheller13:12:37

@danieleneal you can run shadow-cljs pom and import the generated pom.xml in intellij for the project

danielneal14:12:05

ah great, thank you @thheller 🙂

danielneal14:12:49

We’ve got one unusually big file in the build report. It’s not especially interesting, as far as I can tell. Is this a red herring (like there’s always going to be one ‘big’ file, it’s just whichever file includes the big bits of cljs.core first) or something worth investigating - and if worth investigating - what’s the best way of diagnosing the culprit?

thheller14:12:31

thats definitely strange. cljs.core is listed separately

thheller14:12:37

never seen a file that big

thheller14:12:54

might be a macro generated a lot of code?

thheller14:12:18

all the files seem rather big

thheller14:12:36

or did you turn off :advanced?

danielneal14:12:24

I’ll clean everything out and try again

danielneal14:12:42

might be a glitch

danielneal14:12:19

the actual js file looks small

thheller14:12:31

looks small or is small?

thheller14:12:44

I mean the output .js file not the source .cljs file

danielneal14:12:33

I did shadow-cljs release app then shadow-cljs run shadow.cljs.build-report app report.html

danielneal14:12:27

I don’t think I switched off advance, but then I didn’t switch it on - it usually defaults to advanced - perhaps I need to run the build report differently

danielneal14:12:35

this is my first time digging in with it

thheller14:12:26

no this is all you need

thheller14:12:39

unless you set :optimizations :simple it will default to advanced

danielneal14:12:54

cool, yep good

danielneal14:12:26

I am bundling a couple of big json file, but they’re in a different files not the one that is marked as big in the report, and not required by that file

danielneal14:12:55

I’m on 2.8.67, gonna try updating

thheller14:12:59

you don't need to update

thheller14:12:03

you don't need to look at other files

thheller14:12:09

just look at exaclty that file

thheller14:12:16

nothing else is revelevant

danielneal14:12:28

I’m on react native, so at the moment, in release, I’ve got one big index.js.

thheller14:12:30

hmm thats trickier then 😛

thheller14:12:38

maybe just create a browser build that uses that file

danielneal14:12:52

ah cool, good idea

thheller14:12:00

you can look at the cache file too

thheller14:12:12

.shadow-cljs/builds/the-build/dev/ana/...

thheller14:12:28

but its a transit json file so

danielneal14:12:02

look under output.js in that json file?

danielneal14:12:18

in .shadow-cljs/builds/the-build/dev/ana/my/file theres a json file with an output js key which has the relevant compiled js

danielneal14:12:20

but it’s only 20kb

danielneal14:12:47

it’s not advanced though

thheller14:12:58

I'm confused

danielneal14:12:18

oh wait sorry I was looking under /release/ana

thheller14:12:37

that is fine

danielneal14:12:59

I wasn’t able to try the browser build route, I think I’d need to change some of my requires as lots are still using the old (js/require) style

thheller14:12:21

I've never seen a file get larger in :advanced so you are doing something weird

thheller14:12:29

that is fine

thheller14:12:39

your not supposed to actually RUN the code

thheller14:12:43

it just needs to compile

thheller14:12:50

so you get the .js file

thheller15:12:46

but build reports are only really meant to browser builds anyways so maybe its just a bug

thheller15:12:57

I can't think of why it would be though

thheller15:12:16

I've deifnitely seen macros generate a whole bunch of code

danielneal15:12:18

ah ok. I’ll see if I can get the browser build working

danielneal15:12:35

yeah, I know the core.async macros can make a lot of code, so I try to avoid them; we haven’t got any custom macros

thheller15:12:48

but without seeing any code I can only guess

thheller15:12:13

core.async and inline large chunk of EDN data can lead to large files

thheller15:12:33

or any data really .. just edn is a bit bigger than others

danielneal15:12:10

yeah, my guess is that perhaps one of my inlined chunk sof data is showing up in the report as in a different file, maybe I’ll try taking that out and seeing if that makes it smaller

thheller15:12:51

well go into the cache directory

thheller15:12:03

list all the cache files and sort by size

thheller15:12:09

should be easy to spot the big one

thheller15:12:49

or just run shadow-cljs release app --pseudo-names and try to figure it out from there

thheller15:12:57

1.7mb chunk should be easy to find

danielneal15:12:33

ah yeah - the catalog.cljs (which contains the big inlined file) is big in the js but small in optimized, but the pause_orders is big in optimized but small in js column

danielneal15:12:52

thanks for your help - looks like it’s ok bigness that is supposed to be there 🙂 just perhaps ended up in an odd place somehow

Aleed17:12:53

hi i'm trying to use shadow-cljs with expo and next.js. expo actually has built in support for next.js so, since shadow supports expo, wanted to see if I could make it work with nextjs too but running into namespace "good.math.Long" already declared issue: https://github.com/thheller/shadow-cljs/issues/621 ideally i'd like to take advantage of nextjs web optimizations and ease of deployments but wanted to ask, is it even recommended using them together? has anyone successfully gotten it working?