This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-08
Channels
- # bangalore-clj (4)
- # beginners (160)
- # calva (132)
- # cider (18)
- # clara (1)
- # cljsrn (2)
- # clojure (129)
- # clojure-boston (1)
- # clojure-europe (5)
- # clojure-italy (5)
- # clojure-losangeles (1)
- # clojure-nl (33)
- # clojure-uk (49)
- # clojurescript (88)
- # cursive (20)
- # datomic (5)
- # duct (3)
- # fulcro (33)
- # graphql (7)
- # jobs (3)
- # kaocha (3)
- # nrepl (41)
- # off-topic (58)
- # pathom (18)
- # re-frame (1)
- # reagent (5)
- # shadow-cljs (148)
- # spacemacs (7)
- # tools-deps (7)
Hi everybody. Is there a way to reference a local project as a dependency in shadow-cljs.edn
? Like :local/root
does in deps.edn
, I mean.
you could just add the :source-paths
manually too but nothing like :local/root
without deps.edn
Hi, in my shadow-cljs.edn
file i have :source-paths [ "dev" "src" "test" ]
- in the dev
directory, i have company/repl.cljs
, and add :repl-init-ns company.repl
- when i then load the page, i get a 500
error with the message clojure.lang.ExceptionInfo: no output for id: [:shadow.build.classpath/resource "company/repl.cljs"] {:resource-id [:shadow.build.classpath/resource "company/repl.cljs"]
. I've also tried just putting user.cljs
in there, but get the same error. Is there something obvious I'm missing? to start the repl, i'm running shadow-cljs cljs-repl my-project-id
.
Apr 08, 2019 10:16:42 AM io.undertow.server.Connectors executeRootHandler
ERROR: UT005071: Undertow request failed HttpServerExchange{ POST /worker/files/sif/4ef2910a-fa9c-4a38-b142-fcbfbc831193/34c60217-4ac5-46a3-b75c-7567c23309ca request {Accept=[*/*], Accept-Language=[en-US,en;q=0.9], Accept-Encoding=[gzip, deflate], Origin=[], User-Agent=[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.96 Safari/537.36], Connection=[keep-alive], Content-Length=[427], content-type=[application/edn; charset=UTF-8], Referer=[], Host=[]} response {Cache-Control=[private, no-cache]}}
clojure.lang.ExceptionInfo: no output for id: [:shadow.build.classpath/resource "company/repl.cljs"] {:resource-id [:shadow.build.classpath/resource "company/repl.cljs"]}
very weird error that I’m having trouble debugging. trying to get a bare bones shadow-cljs compilation working with my app via lein. have my :depencencies
and :source-paths
set in my project.clj
and :lein true
set at the top level of my shadow-cljs
config. receiving the error Exception in thread "main" Syntax error compiling . at (shadow/build/closure.clj:67:5).
. I’ve stripped down everything in my project.clj
to be absolutely bare bones with just dependencies and src-paths, yet still encountering this error
just declaring everything in shadow cljs and not using lein works for getting my js built. working with a clj/cljs codebase tho and would prefer to not have to duplicate my dependencies declaration for the different platforms
there should be a [com.google.javascript/closure-compiler-unshaded "v20190325"]
dependency
if you still have a cljsbuild
or figwheel
plugin running they might be adding older versions of that dep
The blog post I wrote about my adventures with shadow-cljs and react native navigation was published today: https://040code.github.io/2019/04/02/react-native-navigation-and-clojurescript/. (Here you are @haiyuan.vinurs.) Thanks again @thheller!!
I’m hitting a problem in my project config right now, I’m really stuck trying to understand why it’s not working. My project file looks like this:
{:source-paths [“src”] :dependencies [[cider/cider-nrepl “0.21.0"]] :builds {:app {:target :node-script :output-to “target/main.js” :main server.main/main! :devtools {:after-load server.main/reload!} :js-options {:resolve {“oauth2" {:target :file :file “/src/js/oauth2.js”}}}}}}
the problem here is the :js-options keyword, the compiler continues to tell me this:
[:app] Build failure: Wrong number of args (4) passed to: shadow.build.npm/js-resource-for-file
@thheller good question. Because I wasn’t able to import some functions from a js file I have in my project, so I tried to specify this file in the project config
so you want to include that file directly in your project? it is not an override for something within node_modules
?
(ns server.google-sheet (:require [“fs” :as fs] [“googleapis” :as g] [“oauth2” :as auth :refer (listFiles oAuth2Client)] [clojure.pprint :as pp] [promesa.core :as p]))
ok, but then importing functions from the js file results in the imported symbols being null
what module format do you use? import/export
ESM or require/module.exports
commonjs?
I think so, but hey, at least you directed me on the right track again, I was fighting with the wrong configuration settings
uhm I’m using cider-connect-cljs, it works but right now it’s not finding the .js file
with your :source-paths ["src"]
and the file at src/js/oauth2.js
it would be (require '["/js/oauth2.js" :as x])
the file is loaded from the app and some code is executed, I see the output in the stdout
(ns server.google-sheet (:require [“fs” :as fs] [“googleapis” :as g] [“./oauth2” :as auth :refer (listFiles oAuth2Client)] [clojure.pprint :as pp] [promesa.core :as p])) (prn auth)
literally just shadow-cljs node-repl
then (require '["/server/oauth2.js" :as x])
(js/console.dir x)
nothing else
#js {:default #js {:authorize #object[Function], :listFiles #object[Function], :oAuth2Client #object[OAuth2Client [object Object]]}}
probably best to just switch the file to use export { authorize, listFiles, oAuth2Client }
instead.
its just the annoying situation in that the JS world cannot decide on how to do ESM->CommonJS interop
[:result {:type :repl/error, :ex #error { :cause “closure errors” :data {:tag :shadow.build.closure/errors, :errors [{:resource-name “server/oauth2.js”, :source-name “server/oauth2.js”, :line 93, :column 0, :msg “A file cannot be both a CommonJS module and an ES6 module.“}]}
because commonjs files on the classpath that have require should not be rewritten by closure
shadow-cljs - config: /Users/arusso/Development/clojurescript/ask-scopus/shadow-cljs.edn cli version: 2.8.26 node: v11.13.0 shadow-cljs - server version: 2.8.26 running at http://localhost:9630
totally new to shadow-cljs but i'm excited to start building some node modules! when following the shadow-cljs
repo's readme and also with the minimal-shadow-cljs-browser
i get the following error in the browser:
bidi.js:276 Uncaught SyntaxError: Invalid regular expression: /[Ö‘-Û¯Ûº-ࣿâ€�-��-�ï¬-ï·¿ï¹°-ﻼ]/: Range out of order in character class
at new RegExp (<anonymous>)
at bidi.js:276
any ideas? 🙂next question. the repo's readme refers to :node-script
as a build target where as the docs refer to :node-library
. which one am i after?
ah, they're different. got it. i was hoping to play around with cljs and aws nodejs lambdas.
great, thanks! really looking forward to all the great things i've heard about shadow-cljs.
@rastandy I just pushed 2.8.29
that fixes the broken commonjs interop. so it should be working correctly now, no need for :default
Ah, that was a bug? I'll upgrade too
@joshkh there was a post about shadow-cljs + aws here https://dev.to/royalaid/cljs-s-lambda-697
quick question, I’m trying to figure out the best way to handle a ‘lib’ project. Say I have a project with some common fulcro components and it uses a few react libs, then I want to pull it in to my main ui app, via say clojure deps. I guess I’d need to the main app’s package json also include any of the lib projects npm dependencies?
I may just be misunderstanding things, but it seems like when I run shadow-cljs watch app
, and open my browser, then connect via a CIDER repl, that there are two distinct contexts. For example, I have an atom defined with defonce
- in the browser, it has one value, but at the REPL, it ahs another. Is there a way to unify these two contexts?
The atom should be contain the same because you are eval-ing code in the same runtime...unless your REPL and your Chrome tools are talking to different runtimes like Thomas suggested.
I don't know much about cider sorry but shadow-cljs cljs-repl app
would give you the REPL into the browser
https://shadow-cljs.github.io/docs/UsersGuide.html#cider dunno how current this is
The atom should be contain the same because you are eval-ing code in the same runtime...unless your REPL and your Chrome tools are talking to different runtimes like Thomas suggested.