shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
2020-11-11T00:35:41.477Z

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

thheller 2020-11-11T09:27:46.479Z

@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 Jaro 2020-11-11T13:42:18.480600Z

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

AJ Jaro 2020-11-19T22:42:16.115Z

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

2020-11-11T13:43:23.480800Z

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

thheller 2020-11-11T13:44:00.481200Z

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

thheller 2020-11-11T13:45:12.482400Z

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

AJ Jaro 2020-11-11T13:51:12.482600Z

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

2020-11-11T13:51:39.482800Z

I’m speaking about this url: <http://localhost:3000/js/compiled/cljs-runtime/module$node_modules$date_fns$_lib$addLeadingZeros$index.js.map>

2020-11-11T13:52:09.483Z

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

AJ Jaro 2020-11-11T13:52:53.483200Z

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

thheller 2020-11-11T13:54:10.483400Z

which server do you use?

thheller 2020-11-11T13:54:55.483600Z

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)

2020-11-11T13:56:01.483800Z

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

2020-11-11T13:56:23.484Z

the timeout is 30s (by default)

2020-11-11T14:01:46.484500Z

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 Jaro 2020-11-11T17:56:48.484700Z

@thheller I’m using lein ring server

thheller 2020-11-11T18:09:58.485100Z

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.

thheller 2020-11-11T18:10:47.485700Z

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

jmckitrick 2020-11-11T18:12:30.486500Z

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.

jmckitrick 2020-11-11T18:12:59.487200Z

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

thheller 2020-11-11T18:13:02.487400Z

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

jmckitrick 2020-11-11T18:13:21.487900Z

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

jmckitrick 2020-11-11T18:13:43.488600Z

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

thheller 2020-11-11T18:13:45.488700Z

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

jmckitrick 2020-11-11T18:13:50.488900Z

Hmm. ok.