Fork me on GitHub
#shadow-cljs
<
2020-10-17
>
hyoo05:10:26

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}]}

hyoo05:10:03

It looks like it is caused by

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

hyoo05:10:23

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

thheller08:10:14

@hjfirst no, this is not supported.

hyoo11:10:44

Thanks for clarifying.

Kevin11:10:34

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)

thheller12:10:56

does it say why the connection failed?

Kevin13:10:15

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.

Kevin13:10:46

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

Kevin13:10:06

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 ""

Kevin13:10:45

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 Arrington17:10:36

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.

joshkh21:10:50

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

thheller22:10:23

it produces .shadow-cljs/nrepl.port

joshkh22:10:19

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.

thheller22:10:26

should be working fine assuming you have a current cursive version

thheller22:10:34

older versions only looked for .nrepl-port

thheller22:10:43

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

joshkh23:10:20

yup, that did the trick 🙂

joshkh23:10:43

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

joshkh23:10:45

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