well, I have another problem which seems to be over top of my head 🙂
1. npm package use-cannon
uses react’s lazy
to lazy-load another file relatively from the same package[1]
2. when my app tells react to render component tree, it eventually starts lazy loading that code
3. it ends up calling shadow.js.jsRequire
where it fails to resolve module Module not provided
using relative name “./Provider-480a0e71.js”, at that point shadow.js.nativeRequires
is empty, shadow$provide
is empty, shadow.js.files
contains 67 items, but does not match the name, there are some use_cannon related items, but not the provider[2]
[1] https://github.com/pmndrs/use-cannon/blob/cf8a7482ed9eb8dfc2f39a58bec5b8027caee542/src/index.tsx#L28
[2] https://gist.github.com/darwin/788f7799398b3fd92d77c685d2ae51ea
@darwin dynamic import
is not supported by the closure compiler currently and won't be for the forseeable future. only option is to use a JS packaging tool that does (eg. webpack) via :js-provider :external
https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external
More recently in Chrome I’m receiving a ton of console messages locally like this. How can I help prevent these issues? > DevTools failed to load SourceMap: Could not load content for http://localhost:3000/js/compiled/cljs-runtime/module$node_modules$date_fns$_lib$addLeadingZeros$index.js.map: Load canceled due to load timeout
@darwin Yep, I have no problem going to those URLs
can you open that url in a separate tab? does it load properly?
I'm guessing that you might have too many files in your build?
or maybe the webserver you are using is getting overloaded? shouldn't happen with the servers provided by shadow-cljs but I've seen this happen with other "simple" servers
The view loads properly, but it’s support for sourcemap data in Chrome does not, no.
I’m speaking about this url: <http://localhost:3000/js/compiled/cljs-runtime/module$node_modules$date_fns$_lib$addLeadingZeros$index.js.map>
it must load, btw., the default timeout in devtools is 30s
too many files in the build? Is there a limit? Is there a way to improve the web server?
which server do you use?
I've seen builds with 6000+ files and things start getting weird at that point. technically there is no limit on the shadow-cljs side but browsers starts to struggle (as you are seeing now)
makes sense, looking at the devtools code, there is also maxConcurrentLoads set to 500, so if you have for example 600 files to be loaded, last 100 will be queued up and wait, but timeout will start counting at the time of submission to the queue
the timeout is 30s (by default)
but timeout will start counting at the time of submission to the queue
this was wrong, timeout will start counting when the request is actually initiated
@thheller I’m using lein ring server
sorry can't say anything regarding that. it should be fast enough but no clue. somewhere your timeouts come from. it isn't from shadow-cljs since the files you are loading are just static files from disk. it is either your browser or the server. might be some browser addon or just too many files. the number of files used in a build is logged after each build in the "Build completed" message. would be useful into to know.
I never had an issue like this but its also just source map files so they don't have any influence on the functionality of the site itself
Question: I just started on a clj/cljs project where the devs use cursive. I got the backend up and running with cider. The front end is shadow-based, but since they use cursive, they don't need a cljs repl.
What does the deps.edn or shadow-cljs.edn need so I can jack in with CIDER?
what does cursive have to do with not needing a REPL? 😛
Good point, lol. But they use static analysis and hot reloading.
CIDER is what I'm used to, including jump-to-def etc with CLJS
can't answer the cider question sorry. don't have a clue.
Hmm. ok.