shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
hyoo 2020-10-17T05:53:26.484400Z

Hi all, I got an error like

[2020-10-17 01:50:37.230 - INFO] :shadow.build.npm/js-invalid-requires - {:resource-name "node_modules/@aws-amplify/ui-components/dist/cjs/index-1f3b9bdc.js", :requires [{:line 1630, :column 33}]}

hyoo 2020-10-17T05:56:03.486400Z

It looks like it is caused by

return Promise.resolve().then(function () {
    return _interopNamespace(require(`./${bundleId}.entry.js${ ''}`)); }).then(importedModule => {...}, consoleError);

hyoo 2020-10-17T05:56:23.486700Z

Is there a way to get around this in shadow-cljs?

thheller 2020-10-17T08:57:14.487100Z

@hjfirst no, this is not supported.

hyoo 2020-10-17T11:33:44.488Z

Thanks for clarifying.

kwrooijen 2020-10-17T11:41:34.489900Z

Has anyone tried Cordova with Android platform? I followed this repo https://github.com/thheller/cordova-cljs but I get the Shadow-cljs - reconnecting message. it's noted in the repo that this was only tested on the windows platform, but maybe someone has an idea? (I also removed the Content-Security-Policy part)

thheller 2020-10-17T12:31:56.490600Z

does it say why the connection failed?

kwrooijen 2020-10-17T13:35:15.492400Z

Sorry was afk for a bit. I got the debugger working and had the error ERR_CLEARTEXT_NOT_PERMITTED . I then added a rule in my config.xml to fix this. Now I have an ERR_CONNECTION_REFUSED error. Checking now if I need to add any extra rules or something.

kwrooijen 2020-10-17T13:35:46.493Z

If I can get this to work I'll create a PR to update the README for that repo

kwrooijen 2020-10-17T13:51:06.493900Z

All right, figured it out. Apparently Android needs to look at 10.0.2.2 . So the solution is to add this to your shadow-cljs.edn devtools config: :devtools-url "<http://10.0.2.2:9630>"

kwrooijen 2020-10-17T13:59:45.494500Z

PR to add this info to cordova-cljs repo, so other people don't have to bump their heads against the wall: https://github.com/thheller/cordova-cljs/pull/2

Jack Arrington 2020-10-17T17:39:36.496Z

If I want to use a single, local JS file (not from npm) from CLJS, how do I do that? There is :foreign-libs, but it sounds like that is not compatible with shadow-cljs.

thheller 2020-10-17T17:45:43.496300Z

@mail985 see https://shadow-cljs.github.io/docs/UsersGuide.html#classpath-js

😎 1
Jack Arrington 2020-10-17T17:46:53.496600Z

Perfect, thanks @thheller!

joshkh 2020-10-17T21:49:50.497200Z

should npx shadow-cljs server produce a .nrepl-port file?

thheller 2020-10-17T22:10:13.497500Z

no

thheller 2020-10-17T22:10:23.497800Z

it produces .shadow-cljs/nrepl.port

joshkh 2020-10-17T22:28:19.499100Z

got it, thanks @thheller. i'm just working on an easy Cursive setup, and the "Use port from nREPL file" isn't working. i probably botched something on my end.

thheller 2020-10-17T22:43:26.001Z

should be working fine assuming you have a current cursive version

thheller 2020-10-17T22:43:34.001300Z

older versions only looked for .nrepl-port

thheller 2020-10-17T22:43:43.001600Z

newer versions definitely support .shadow-cljs/nrepl.port

joshkh 2020-10-17T23:02:20.002500Z

yup, that did the trick 🙂

joshkh 2020-10-17T23:07:43.005300Z

and one last non-pressing thing (i'm sure i'll find it in the docs after asking)

(ns app
  (:require ["left-pad" :as left-pad]))

; Cursive loading the app.cljs ns in the repl:
Loading src/main/app.cljs... 
Syntax error macroexpanding clojure.core/ns at (src/main/app.cljs:1:1).
((:require ["left-pad" :as left-pad])) - failed: Extra input spec: :clojure.core.specs.alpha/ns-form

joshkh 2020-10-17T23:16:45.006400Z

ah, shadow/repl wasn't running. as always, thanks for your help