your question really is a little vague. there are about hundreds of ways to do this, it really depends on your app and how you want to do it. :closure-defines
would be the build-config driven variant. see also https://shadow-cljs.github.io/docs/UsersGuide.html#_release_specific_vs_development_configuration
you can also get stuff from the HTML directly, or load if via fetch on startup. really far to many options to mention them all.
👋 I have this problem working with npm library called js-waku
https://stackoverflow.com/questions/66309813/the-required-js-dependency-readable-stream-writable-js-is-not-available-it-wa
I tried forcing version 2.0.2 of readable-stream
as suggested in SO solution
but get another error after that transpilation of BigInt is not supported
Thank you for any help unraveling this mystery
try :compiler-options {:output-feature-set :es2018}
in your build config. maybe :es2019
or :es2020
. not sure which language level bigints were
Cool thank you that make sense I will give it a go
Seems it was in :es2020
but still no dice 😞
I get failed to convert sources
on a whole bunch of libraries
I cannot guess the errors you get sorry
:ex-next-in
is the highest level possible, maybe that works
ooohh that might
js-waku
is written in typeScript with compiler option esnext
that isn't relevant, js config options don't apply to closure compiler options
still that did not work same failed to convert sources
error
npx shadow-cljs watch frontend
shadow-cljs - config: /Users/yalu/Projects/nemonymous/shadow-cljs.edn
shadow-cljs - HTTP server available at <http://localhost:8080>
shadow-cljs - server version: 2.13.0 running at <http://localhost:9630>
shadow-cljs - nREPL server started on port 50869
shadow-cljs - watching build :frontend
[:frontend] Configuring build.
[:frontend] Compiling ...
[:frontend] Build failure:
failed to convert sources
{:tag :shadow.build.closure/convert-error, :sources [[:shadow.build.npm/resource "node_modules/object-assign/index.js"] [:shadow.build.npm/resource "node_modules/react/cjs/react.production.min.js"] [:shadow.build.npm/resource "node_modules/react/cjs/react.development.js"] [:shadow.build.npm/resource "node_modules/react/index.js"] .............................................
don't shorten errors ... you cut out the reason why it failed
It was too big to fit.. so attaching file of log
RuntimeException: INTERNAL COMPILER ERROR.
Please report this problem.
null
Node(SHEQ): node_modules/bcrypto/lib/native/bn.js:3605:6
if ((y & 1n) === 0n)
Parent(IF): node_modules/bcrypto/lib/native/bn.js:3605:2
if ((y & 1n) === 0n)
this is a closure-compiler error, it appears that it doesn't support the code
you can try using webpack with this method https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external
Thank you for the prompt response and incredible patience 🙏 I will give webpack a go
are you sure this code is supposed to be supported in the browser? I see a bunch of node specific stuff so it looks like a node thing to me?
I am pretty sure it is supposed to be supported in the browser https://www.npmjs.com/package/js-waku
hmm yeah seems rather cutting edge
yeah.. freshly released.. hardly battle tested.. I'm also communicating with the dev.. so let's see I'm going to try everything I can