Fork me on GitHub
#shadow-cljs
<
2021-09-07
>
chrisetheridge09:09:12

is it safe to retain the .shadow-cljs directory between release builds of clojurescript? we previously have been deleting that folder before we run a release build, in fear of stale cache or dependencies. retaining it makes our build at least 1 minute faster, so we want to see if its safe to no longer delete it between release builds

thheller16:09:23

yes, safe. I never delete mine. no cache issues for a couple years now

chrisetheridge08:09:10

cool, thank you!

huygn09:09:33

hi I'm using below build config and :module-hash-names doens't work, the output is still client.js file without any hash :thinking_face:

:client {:target :esm
           :runtime :browser
           :output-dir "dist/client"
           :modules {:client {:entries [app.client]
                              :exports {hydrate app.client/hydrate-app}}}
           :devtools {:before-load app.client/stop
                      :after-load app.client/start}
           :module-hash-names 8
           :build-options {:manifest-name "manifest.json"}}

thheller16:09:53

:module-hash-names currently is only supported for :browser builds

👍 2
jjttjj14:09:42

I've read https://widdindustries.com/cljs-npm-libraries/ but I'm still a bit confused on the best practice for packaging a cljs library that depends on a [single] js library. Currently the js and externs are included in the project. Should I just the stub namespace with js/goog.exportSymbol described in the shadow docs and add that stub to the library source code and call it a day? Specifically, I'm trying to address this issue in this project: https://github.com/funcool/decimal/issues/7

thheller16:09:35

you can change this file

thheller16:09:55

to provide decimal.js instead of decimal.extern.decimaljs

thheller16:09:10

then in the code actually (:require ["decimal.js" :as dec]) or so

thheller16:09:27

and then also add :npm-deps {"decimal.js" "version"} to the deps.cljs file

thheller16:09:32

shadow-cljs will be happy with that

thheller16:09:52

and the others will just use the bundled foreign lib as before

thheller16:09:16

or need to hange the js/Decimal uses as well to use the alias. I'm not entirely sure what you need to add to deps.cljs for that to work though

thheller16:09:30

suggest looking at cljsjs/react or so, they do that

jjttjj20:09:14

Awesome, thanks!

kennytilton14:09:39

Ugh, back to EISDIR! All my RN experiments seem to end here. 😭 Any thoughts on how this suddenly arises? Thx! 🙏

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:626:3)
    at tryReadSync (node:fs:391:20)
    at Object.readFileSync (node:fs:428:19)
    at UnableToResolveError.buildCodeFrameMessage (/Users/kennethtilton/dev/matrix/cljs/shadow/matrixrn/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:304:17)
    at new UnableToResolveError (/Users/kennethtilton/dev/matrix/cljs/shadow/matrixrn/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:290:35)
    at ModuleResolver.resolveDependency (/Users/kennethtilton/dev/matrix/cljs/shadow/matrixrn/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:168:15)
    at DependencyGraph.resolveDependency (/Users/kennethtilton/dev/matrix/cljs/shadow/matrixrn/node_modules/metro/src/node-haste/DependencyGraph.js:353:43)
    at /Users/kennethtilton/dev/matrix/cljs/shadow/matrixrn/node_modules/metro/src/lib/transformHelpers.js:271:42
    at Server.<anonymous> (/Users/kennethtilton/dev/matrix/cljs/shadow/matrixrn/node_modules/metro/src/Server.js:842:41)
    at Generator.next (<anonymous>)
....etc etc

kennytilton15:09:49

n.m. Looks like quite a mess overall.

thheller16:09:08

hmm odd. maybe there is a directory with the same name of a file or so?

kennytilton16:09:41

OMG. Happens only if (a) I have the dev console open (b) in the Expo debugger_ui, @U05224H0W. Then:

DevTools failed to load source map: Could not load content for : Fetch through target failed: Target not supported; Fallback: HTTP error: status code 500, net::ERR_HTTP_RESPONSE_CODE_FAILURE
sigh

thheller16:09:13

don't know what that means sorry. not a shadow-cljs error, proably RN

kennytilton17:09:56

Oh, sorry, @U05224H0W. It means I can just ignore those. 🙂 Part of getting up to speed on a new stack and is figuring out which garbage coming out of our tools can be ignored. I prolly gave up on three efforts because sth was going wrong and then I noticed the EISDIRs and gave them the credit. It's a good thing I like this game! 🙂

kennytilton17:09:52

Yes, Expo is blaming RN. https://github.com/facebook/react-native/issues/28844 I am always happy to see FB engineers dragged thru the mud. 🙂

az18:09:25

Hi all, I’m trying to use the https://ant.design/docs/react/use-with-create-react-app lib in a helix project and I’m struggling to get the css importing. I can load from CDN, but the css is larger and they recommend not to do this, but instead allow for webpack to tree shake the css. How would I convert an import statement like @import "antd/dist/antd.css"; listed in their docs which pulls from node_modules/antd to work with a shadow project?

Ryan Jerue19:09:46

I just have this stuck in the head of my index.html

<link rel="stylesheet" href="" integrity="sha512-Gfp2ZD1ULgfgThJArElWdfu/bPK67HVrx+rKfLfclPyRUlf68R7uHIy5zaPnZpv6ZuIX/ykmJCv3Q1bnfZngEg==" crossorigin="anonymous" referrerpolicy="no-referrer" />

az19:09:57

Any thoughts on size though? @U01GNU0Q0MB - I see they mention they strongly recommend not importing from Cdn

az19:09:02

What do you think?

az19:09:50

I guess it’s pretty well cached at this point

Ryan Jerue19:09:20

As for size, this is just the CSS being loaded. If you were to do it using an import, it would import the same thing. Size argument comes into play with the actual js components

Ryan Jerue19:09:47

I’m not sure what optimizations shadow will do (if any) for tree shaking. Webpack will do a ton which is why they don’t suggest the cdn

az19:09:50

I see ok great

az19:09:18

Got it makes sense.

az18:09:21

by the way I’m using postcss and tailwind jit and that is working well. Wondering if I should be plugging in antd css into that build pipeline somehow?

Fredrik Andersson21:09:32

I'm trying to use Firebase 9.0.1 web-api. Googles documentation names the version "Firebase Modular Web SDK v. 9.0" which I suppose means that it utilize es6 modules? I'm not well versed in es6 so I don't understand this very well. I just wan't to know how I would use them in clojurescript with shadow-cljs