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]
The ES6+ import example from that NPM page looks like this
import { CognitoIdentityProviderClient, AddCustomAttributesCommand } from "@aws-sdk/client-cognito-identity-provider";
I'd be interested to know about your workflow when working with web apps. Would you mind sharing? 😄 Do you just enable the autobuild when watching file changes?
Upgrading shadow to the latest seemed to resolve the issue. Weird as a colleague on an older version didn’t experience it.
@stuartrexking that is a known issue that I have not been able to reproduce and track down unfortunately
Fun. Thanks though.
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?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 😅
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?
(shadow/nrepl-select :app)
Syntax error compiling at (REPL:1:1).
No such namespace: shadow
what did you require :as shadow
?
nothing, I never had to, in every other project when I connect to shadow it's already there
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:
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?
no, my setup is usually close to raw, simple deps with shadow, then I connect via nrepl to it
no plugins related to repl
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
check which ns you are in. should be shadow.user
, that has the shadow
alias.
but yeah to be safe use the full name
> npm install bulma Can I make shadow serve css out of that node_module during dev watch & whatnot?
no, css is not supported
I mean sure you can make it serve static files just fine but it won't process css in any way
I guess symlink in public is the way for now.
I just copy stuff personally
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)
@adam678 which version is this? I fixed this not too long ago
I upgraded some time ago to 2.11.4 but it didn't go away
I'll upgrade again then
I think I fixed it in 2.11.10
just try 2.11.15
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
Is there webpack integration? Seems I have to use this style-loader thing: https://webpack.js.org/loaders/style-loader/
like I said earlier. css is not supported.
roger & apologies - I was under the impression that I'm asking different things (ie. assets bundling vs this error)
FWIW you can use webpack with shadow-cljs to handle this
as described here https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external
I think monaco still requires adding a webpack plugin though. not sure.
good point, I in this case it starts in a different ns 👍
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 <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
remote:
remote: -----> Build failed
sorry don't know anything about heroku but java will be required to build things
dunno why you have to build on heroku though. you could just build locally and deploy the static files
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.
Thanks I appreciate the pointers. And thanks for shadow-cljs. It's been cool using it!
Right, I built locally. I think what you're saying is that I don't have to deploy the whole repo. Is that right?
Would you be willing to tell me how I can do that? I tried deleting all the clojurescript files/folders but then it broke.
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?
@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.
I do build it. But then I get that java missing error. I think there's a problem with Heroku.
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.
Yes, it gives me a public folder with javascript and css. I haven't found a way to run it though.
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.