Fork me on GitHub
#shadow-cljs
<
2021-01-28
>
stuartrexking06:01:39

I’m trying to use https://www.npmjs.com/package/@aws-sdk/client-cognito-identity-provider from a :browser target. When I require what I need like this

(ns main
  (:require
   ["@aws-sdk/client-cognito-identity-provider" :refer [CognitoIdentityProviderClient]]))
I get an error returned
#object[TypeError TypeError: $jscomp.inherits is not a function]

stuartrexking06:01:43

The ES6+ import example from that NPM page looks like this

import { CognitoIdentityProviderClient, AddCustomAttributesCommand } from "@aws-sdk/client-cognito-identity-provider";

stuartrexking08:01:31

Upgrading shadow to the latest seemed to resolve the issue. Weird as a colleague on an older version didn’t experience it.

thheller09:01:06

@stuartrexking that is a known issue that I have not been able to reproduce and track down unfortunately

stuartrexking09:01:06

Fun. Thanks though.

socksy10:01:42

going a bit crazy with a new project and tools.deps integration. Certain I had this working before. I have a deps.edn like:

{:paths ["src"]
 :deps {}
 :aliases 
 {:dev
  {:extra-deps {thheller/shadow-cljs {:mvn/version "2.9.2"}}}
   :main-opts ["-m" "shadow.cljs.devtools.cli"]}}
and a shadow-cljs.edn like:
{:deps true
 :builds {:app
          {:target :node-script
           :output-to "target/main.js"
           :output-dir "target"
           :exports {:handler platform.core/handler}}}}
but when I run clj -M:dev watch app, I get
Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
watch (No such file or directory)
What am I missing?

socksy10:01:33

oh fuck it was wrongly nested braces in the deps.edn. The closing brace on extra-deps line meant that :main-opts was added as an alias and so ignored. Thanks for the help 😅

wilkerlucio17:01:43

hello, I'm having an issue to use the shadow ns in a project here, it says the namespace isn't defined, but others like shadow.cljs.devtools.server.nrepl are there, any ideas what could be wrong?

wilkerlucio17:01:26

(shadow/nrepl-select :app)
Syntax error compiling at (REPL:1:1).
No such namespace: shadow

dpsutton17:01:28

what did you require :as shadow?

wilkerlucio17:01:49

nothing, I never had to, in every other project when I connect to shadow it's already there

wilkerlucio17:01:21

I found I can fix by running the full name (shadow.cljs.devtools.api/nrepl-select :app), but found strange why only in this project I cant use just shadow/nrepl-select :thinking_face:

dpsutton17:01:22

must have some tooling that requires it? I think CIDER might do this to start up. not sure if you're reusing a repl from that or something?

wilkerlucio17:01:26

no, my setup is usually close to raw, simple deps with shadow, then I connect via nrepl to it

wilkerlucio17:01:41

no plugins related to repl

wilkerlucio17:01:33

its funny, I have a snippet to start shadow, which spits (shadow/nrepl-select $NAME$), I've been using this snippet for many years now, in many different projects (with various different setup configurations), that's why this situation puzzles me

thheller18:01:12

check which ns you are in. should be shadow.user, that has the shadow alias.

thheller18:01:30

but yeah to be safe use the full name

wilkerlucio21:01:23

good point, I in this case it starts in a different ns 👍

clyfe18:01:28

> npm install bulma Can I make shadow serve css out of that node_module during dev watch & whatnot?

thheller18:01:33

no, css is not supported

thheller18:01:55

I mean sure you can make it serve static files just fine but it won't process css in any way

👍 3
clyfe18:01:43

I guess symlink in public is the way for now.

thheller18:01:59

I just copy stuff personally

Adam Helins18:01:49

Shadow sometimes starts throwing when evaling cljs, forcing me to restart it. It happens after a while, somewhat randomly. I don't have any cljs/user.cljs file since I know that Shadow treats it specially. I guess this must be because something is missing in my config:

[2021-01-28 19:37:26.204 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:op :cljs-load-sources, :sources [[:shadow.build.classpath/resource "cljs/repl.cljs"] [:shadow.cljs.repl/resource "cljs/user.cljs"]], :call-id 3, :from 10}}
ExceptionInfo no output for id: [:shadow.cljs.repl/resource "cljs/user.cljs"] {:resource-id [:shadow.cljs.repl/resource "cljs/user.cljs"]}
        shadow.build.data/get-output! (data.clj:197)
        shadow.build.data/get-output! (data.clj:193)
        shadow.cljs.devtools.server.worker.impl/eval17184/fn--17187/fn--17190 (impl.clj:813)
        clojure.core/map/fn--5866 (core.clj:2753)
        clojure.lang.LazySeq.sval (LazySeq.java:42)
        clojure.lang.LazySeq.seq (LazySeq.java:51)
        clojure.lang.RT.seq (RT.java:535)
        clojure.core/seq--5402 (core.clj:137)
        clojure.core.protocols/seq-reduce (protocols.clj:24)
        clojure.core.protocols/fn--8146 (protocols.clj:75)
        clojure.core.protocols/fn--8146 (protocols.clj:75)
        clojure.core.protocols/fn--8088/G--8083--8101 (protocols.clj:13)

thheller19:01:37

@adam678 which version is this? I fixed this not too long ago

Adam Helins19:01:29

I upgraded some time ago to 2.11.4 but it didn't go away

Adam Helins19:01:44

I'll upgrade again then

thheller19:01:46

I think I fixed it in 2.11.10

thheller19:01:51

just try 2.11.15

👍 3
clyfe20:01:07

Failed to inspect file
  /home/clyfe/dev/riviera/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standalone-tokens.css

it was required from
  /home/clyfe/dev/riviera/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneEditor.js

clyfe20:01:56

Is there webpack integration? Seems I have to use this style-loader thing: https://webpack.js.org/loaders/style-loader/

thheller20:01:20

like I said earlier. css is not supported.

😅 3
clyfe20:01:57

roger & apologies - I was under the impression that I'm asking different things (ie. assets bundling vs this error)

thheller21:01:41

FWIW you can use webpack with shadow-cljs to handle this

👍 3
thheller21:01:04

I think monaco still requires adding a webpack plugin though. not sure.

Mark McQuillen21:01:11

Hello, I would be grateful for some help deploying an app to Heroku. I built a shadow-cljs app using: https://github.com/filipesilva/create-cljs-app Worked fine locally. But then I tried deploying it to Heroku and I got this error: "Executable 'java' not found on system path." I even tried deploying the default app provided from both my computer and Cloud9 IDE and I got the same error. Any thoughts on how to get this work? Thanks!

remote: -----> Build
remote:    Running build (yarn)
remote:    yarn run v1.22.10
remote:    $ yarn clean && shadow-cljs release app
remote:    $ rimraf public/js
remote: shadow-cljs - config: /tmp/build_8c64e158/shadow-cljs.edn
remote: ===== ERROR =================
remote: Executable 'java' not found on system path.
remote: =============================
remote: error Command failed with exit code 1.
remote:    info Visit  for documentation about this command.
remote: 
remote: -----> Build failed

thheller21:01:46

sorry don't know anything about heroku but java will be required to build things

thheller21:01:16

dunno why you have to build on heroku though. you could just build locally and deploy the static files

Mark McQuillen21:01:36

Would you be willing to tell me how I can do that? I tried deleting all the clojurescript files/folders but then it broke.

thheller09:01:09

in your build config you have an :output-dir. lets assume that is public so everything in the public folder you put on heroku on a static site. you don't tell it about shadow-cljs or npm or java or any of that. you purely put STATIC files on heroku. I assume there is a way to do that but I don't know how.

👍 3
Mark McQuillen14:01:54

Thanks I appreciate the pointers. And thanks for shadow-cljs. It's been cool using it!

Mark McQuillen21:01:55

Right, I built locally. I think what you're saying is that I don't have to deploy the whole repo. Is that right?

Mark McQuillen22:01:32

Can someone please recommend a service to deploy a shadow-cljs app? I tried Heroku and it didn't work. Can you tell me one that does?

stuartrexking22:01:32

@markdmcq That repo you linked to outputs a static single page app. Any static hosting site should be able to host it once you have built it.

Mark McQuillen23:01:13

I do build it. But then I get that java missing error. I think there's a problem with Heroku.

stuartrexking23:01:18

You need java and npm to build that site though. You would normally do that on your machine before deploying (copying) the output files (html, js, css) to a static site somewhere.

Mark McQuillen23:01:36

Yes, it gives me a public folder with javascript and css. I haven't found a way to run it though.

stuartrexking23:01:41

Once you have the static files you just need to put them somewhere that can serve them, like a webserver or CDN or a static site hosting. They won’t be run like I think you are suggesting.