This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-04
Channels
- # aleph (1)
- # announcements (7)
- # beginners (22)
- # calva (31)
- # cider (2)
- # clj-commons (1)
- # clj-http (2)
- # clj-kondo (10)
- # cljsrn (33)
- # clojure (18)
- # clojure-europe (7)
- # clojure-nl (3)
- # clojure-uk (2)
- # clojurescript (93)
- # depstar (3)
- # events (1)
- # figwheel-main (3)
- # fulcro (13)
- # graalvm (95)
- # graphql (1)
- # introduce-yourself (1)
- # lsp (92)
- # off-topic (2)
- # pathom (11)
- # releases (1)
- # shadow-cljs (33)
- # specter (6)
- # tools-deps (4)
- # vim (3)
- # web-security (1)
- # xtdb (7)
So I compiled a release build using shadow-cljs release app
and it builds fine but how do I actually run the release build? Everything I am trying is failing. shadow-cljs watch app
still works for the dev build. But anything like shadow-cljs run app
or shadow-cljs run core
give me classpath errors
just start a server in the public folder. the release files are just javascript.
python -m http.server 8000
for example. Then point the browser to localhost:8000
and your app will load.
yeah I tried that and it's trying to reconnect to shadow-cljs so I think that is still running the dev setup?
yeah, it sounds like that could be the issue. try deleting your ‘js’ folder inside ‘public’ before running ‘release’.
ah, if you just want the http server back you can run shadow-cljs server
. as a bonus while that is running shadow-cljs release app
is also much faster
As a side note, on a small Hello World Reagent app, running the release build with optimizations set to :advanced
I get a performance score of 86% on Lighthouse (it says I should reduce my unused JS but I thought that is what the optimizations/Google Closure Compiler took care of?). It says my JS transfer size is 271kb but it thinks there is potential savings of 168kb more. Does that sound about right? How would I get that extra savings (it says it would save my transfer time 1.2 sec from 3.2s which sounds big or am I prematurely optimizing here)?
you can create a build report to figure out what exactly is in your build and how large https://shadow-cljs.github.io/docs/UsersGuide.html#build-report
Ahh, cool! Yeah its 60% cljs/core.cljs
which I guess is to be expected. I assume as I continue building out the app, the size will grow at a slower rate (if that makes any sense)
yeah cljs.core is typically the largest one. some other exceptions but they are usually easily avoided (eg. cljs.pprint)
I installed the js sdk for browser client using npm i --save moralis, but I’m getting the following error:
The required JS dependency "json-rpc-engine/src/createAsyncMiddleware" is not available, it was required by "node_modules/eth-json-rpc-middleware/block-cache.js".
node_modules/moralis/index.js
node_modules/moralis/lib/browser/Parse.js
node_modules/moralis/lib/browser/decode.js
node_modules/moralis/lib/browser/ParseACL.js
node_modules/moralis/lib/browser/ParseUser.js
node_modules/moralis/lib/browser/MoralisWeb3.js
node_modules/moralis/lib/browser/MoralisWalletConnectProvider.js
node_modules/@walletconnect/web3-provider/dist/esm/index.js
node_modules/web3-provider-engine/subproviders/cache.js
node_modules/eth-json-rpc-middleware/block-cache.js
I tried removing node_modules and reinstalling using npm i. I also tried npm i --save json-rpc-engine but that still gives the error. I tried npm i --save json-rpc-engine/src/createAsyncMiddleware, but that npm package doesn’t exist. How to fix this?looks like the eth-json-rpc-middleware
package maybe expects a different version of json-rpc-engine
than you have installed
So I just had a (naive) working template to run/deploy with Deno & shadow-cljs, used uix
for render/hydrate a simple React app. Thanks @thheller for adding esm
support! now I just wished watch
mode would work for esm target too.
deploy url: https://deno-cljs.deno.dev
https://github.com/huygn/deno-cljs-template
hmm my error being document
was referenced in :server
build, but compile/release mode works fine :thinking_face:
> deno run -A --unstable --watch src/index.ts
Check file:///Users/macair/src/github.com/huygn/my-project/src/index.ts
error: Uncaught ReferenceError: document is not defined
return goog.dom.createElement_(document, name);
^
at Object.goog.dom.createElement (file:///Users/macair/src/github.com/huygn/my-project/dist/server/cljs-runtime/goog.dom.dom.js:288:34)
at file:///Users/macair/src/github.com/huygn/my-project/dist/server/cljs-runtime/goog.style.transition.js:39:21
at Object.isSupported (file:///Users/macair/src/github.com/huygn/my-project/dist/server/cljs-runtime/goog.functions.functions.js:142:15)
at file:///Users/macair/src/github.com/huygn/my-project/dist/server/cljs-runtime/shadow.dom.js:3:99
not like it doesn't work (should have correct that), but in my case I have no clue what caused this
Now I’m getting this error on auto-reload:
no source by provide: module
{:provide module}
ExceptionInfo: no source by provide: module
shadow.build.data/get-source-id-by-provide (data.clj:186)
shadow.build.data/get-source-id-by-provide (data.clj:183)
shadow.build.data/get-source-by-provide (data.clj:189)
shadow.build.data/get-source-by-provide (data.clj:188)
shadow.build.js-support/shim-require-sugar-resource/fn--34338 (js_support.clj:107)
shadow.build.data/get-source-code (data.clj:319)
shadow.build.data/get-source-code (data.clj:306)
shadow.build.closure/convert-goog*/iter--34184--34188/fn--34189/fn--34190 (closure.clj:2187)
shadow.build.closure/convert-goog*/iter--34184--34188/fn--34189 (closure.clj:2186)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:51)
clojure.lang.ChunkedCons.chunkedNext (ChunkedCons.java:59)
clojure.core/chunk-next (core.clj:710)
clojure.core.protocols/fn--8176 (protocols.clj:137)
clojure.core.protocols/fn--8176 (protocols.clj:124)
clojure.core.protocols/fn--8136/G--8131--8145 (protocols.clj:19)
clojure.core.protocols/seq-reduce (protocols.clj:31)
clojure.core.protocols/fn--8168 (protocols.clj:75)
clojure.core.protocols/fn--8168 (protocols.clj:75)
clojure.core.protocols/fn--8110/G--8105--8123 (protocols.clj:13)
clojure.core/reduce (core.clj:6830)
clojure.core/into (core.clj:6897)
clojure.core/into (core.clj:6889)
shadow.build.closure/convert-goog* (closure.clj:2190)
shadow.build.closure/convert-goog* (closure.clj:2182)
shadow.build.closure/convert-goog (closure.clj:2361)
shadow.build.closure/convert-goog (closure.clj:2311)
shadow.build.compiler/maybe-closure-convert (compiler.clj:1195)
shadow.build.compiler/maybe-closure-convert (compiler.clj:1188)
shadow.build.compiler/compile-all (compiler.clj:1426)
shadow.build.compiler/compile-all (compiler.clj:1307)
shadow.build.api/compile-sources (api.clj:261)
shadow.build.api/compile-sources (api.clj:253)
shadow.build/compile (build.clj:442)
shadow.build/compile (build.clj:432)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:363)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:344)
shadow.cljs.devtools.server.worker.impl/do-resource-update (impl.clj:531)
shadow.cljs.devtools.server.worker.impl/do-resource-update (impl.clj:486)
shadow.cljs.devtools.server.util/server-thread/fn--37229/fn--37230/fn--37238 (util.clj:284)
shadow.cljs.devtools.server.util/server-thread/fn--37229/fn--37230 (util.clj:283)
shadow.cljs.devtools.server.util/server-thread/fn--37229 (util.clj:256)
java.lang.Thread.run (Thread.java:748)
I restarted shadow watch and it started working
As a side note, on a small Hello World Reagent app, running the release build with optimizations set to :advanced
I get a performance score of 86% on Lighthouse (it says I should reduce my unused JS but I thought that is what the optimizations/Google Closure Compiler took care of?). It says my JS transfer size is 271kb but it thinks there is potential savings of 168kb more. Does that sound about right? How would I get that extra savings (it says it would save my transfer time 1.2 sec from 3.2s which sounds big or am I prematurely optimizing here)?