Fork me on GitHub
#shadow-cljs
<
2020-11-11
>
darwin00:11:41

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

thheller09:11:46

@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

✔️ 1
AJ Jaro13:11:18

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

darwin13:11:23

can you open that url in a separate tab? does it load properly?

AJ Jaro13:11:12

The view loads properly, but it’s support for sourcemap data in Chrome does not, no.

darwin13:11:39

I’m speaking about this url:

darwin13:11:09

it must load, btw., the default timeout in devtools is 30s

AJ Jaro22:11:16

@darwin Yep, I have no problem going to those URLs

thheller13:11:00

I'm guessing that you might have too many files in your build?

AJ Jaro13:11:53

too many files in the build? Is there a limit? Is there a way to improve the web server?

thheller13:11:10

which server do you use?

thheller13:11:55

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)

darwin13:11:01

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

darwin13:11:23

the timeout is 30s (by default)

darwin14:11:46

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

AJ Jaro17:11:48

@U05224H0W I’m using lein ring server

thheller18:11:58

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.

thheller18:11:47

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

thheller13:11:12

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

jmckitrick18:11:30

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.

jmckitrick18:11:59

What does the deps.edn or shadow-cljs.edn need so I can jack in with CIDER?

thheller18:11:02

what does cursive have to do with not needing a REPL? 😛

jmckitrick18:11:21

Good point, lol. But they use static analysis and hot reloading.

jmckitrick18:11:43

CIDER is what I'm used to, including jump-to-def etc with CLJS

thheller18:11:45

can't answer the cider question sorry. don't have a clue.