This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-03
Channels
- # aleph (1)
- # announcements (9)
- # babashka (3)
- # beginners (200)
- # calva (22)
- # cider (74)
- # clojure (97)
- # clojure-dev (43)
- # clojure-europe (15)
- # clojure-italy (4)
- # clojure-nl (4)
- # clojure-sanfrancisco (2)
- # clojure-uk (103)
- # clojuredesign-podcast (2)
- # clojurescript (45)
- # core-async (5)
- # cursive (13)
- # datomic (42)
- # emacs (20)
- # fulcro (6)
- # graalvm (37)
- # jackdaw (10)
- # leiningen (7)
- # mid-cities-meetup (3)
- # off-topic (2)
- # pathom (1)
- # pedestal (3)
- # re-frame (6)
- # reagent (38)
- # reitit (5)
- # shadow-cljs (117)
- # spacemacs (1)
- # sql (1)
- # tools-deps (17)
- # vim (14)
- # xtdb (18)
Is there a shadow-cljs equivalent to lein ancient
?
If you're using Shadow-CLJS with deps.edn
, you can use olical/depot. Here's my global deps.edn
alias:
:outdated
{:extra-deps {olical/depot {:mvn/version "1.8.4"}}
:main-opts ["-m" "depot.outdated.main"]}
Thanks! At this point I only have a shadow-cljs.edn
, I am unclear as to what adding a deps.edn
would do, wouldn’t that be two different places to specify the dependencies which could get out of sync?
You can ask Shadow-CLJS to use deps.edn
to speficy dependencies: https://shadow-cljs.github.io/docs/UsersGuide.html#deps-edn
This functionality is in place just to avoid the duplication you're (rightly) reluctant to create. The advantage being that you can plug into the rest of the ecosystem for deps.edn
/ tools-deps
🙂
Time to learn deps.edn
…
Hi friends! does anyone here have experience with code reloading in a Cordova + cljs + shadow-cljs stack please ? I am really interested if you could point me to a resource I can pick ideas from. Thanks in adv
I’ve managed to connect to remote shadow server, but Send to repl
does not work properly
(+ 1 1)
Syntax error compiling at (REPL:1:1).
Unable to resolve symbol: + in this context
@achikin I think you get that result if you (in-ns 'foo.bar)
without having (require 'foo.bar)
first, ie. switching before actually loading
I’m running shadow-cljs watch app
in a separate terminal and trying to connect to it with Cursive remote repl
Is there any way to make Cursive run (shadow.cljs.devtools.api/repl :app) automatically?
I'm sure this is more of a node/closure/javascript question, but how the heck do I import a path? (I'm trying to import parts of three.js into my cljs app). All I get is:
Cannot import Closure files by path. Use either import goog:namespace or goog.require(namespace)
yeah, from cljs I have no problem importing npm modules or even files paths from the source-paths, but this is inside a js file that wants to import other js files
thanks, incidentally I'm on that page. the original js did
import { OceanShaders } from "../shaders/OceanShaders.js";
but that results in undefined. any other form results in "Cannot import Closure files by path..."if you’re consuming js files via shadow-cls make sure the js files you’re importing are inside a registered cljs path (or inside you’re node_modules)
would help to have a complete example to look at. can't quite figure out what you are doing.
in cljs, I am doing:
(:require
["/jsm/misc/Ocean" :as ocean]
that Ocean.js tries to import OceanShaders.js with:
import { OceanShaders } from "../shaders/OceanShaders.js";
OceanShaders there passes compilation but comes up as undefined. Elsewhere, I rewrote a similar syntax to:
import * as three from 'three';
const {...} = three;
to make it work. If I try to rewrite similarly:
import * as OceanShadersLib from "../shaders/OceanShaders.js";
const {OceanShaders} = OceanShadersLib;
it'll fail with:
Closure compilation failed with 1 errors
jsm/misc/Ocean.js:64
Cannot import Closure files by path. Use either import goog:namespace or goog.require(namespace)
sorry I need to see this in actual files otherwise my brain has issue putting things together 😛
I could make a barebones project demonstrating this but you probably don't want to see all of these files, there's a lot. but this issue comes from closure compiler and I'm not quite sure why it cares
well .. first of all the closure-compiler does NOT understand how shadow-cljs processes npm deps
shadow-cljs isn't really meant to compile JS projects. it is very lacking in that regard. its possible for easy stuff but I haven't put much work into the full support
if you setup a reproducible example I can take a look but otherwise there are too many unknowns for me that I cannot reconstruct from slack threads
yes, I understand. I'm not sure though whether it's the closure compiler that is the limitation of if you could even do something about it in shadow
or, if I can just require it in cljs and just kind of make it visible to the js. I don't know, really don't know enough about all these npm, esm modules or requires
listen ... I do want to help you but I can't without knowing more about what you are doing
I know a lot about npm, esm, modules, requires, etc but NOTHING about your actual code/setup so you might see the problem
yes, thanks for replying. I really just wanted to see if it's possible to work with an existing large js codebase and cljs. it's basically this: https://github.com/mrdoob/three.js/blob/dev/examples/webgl_shaders_ocean2.html
the latest version of three.js npm module includes all examples on the same level as the build folder
I was reading https://github.com/google/closure-compiler/wiki/JS-Modules and I guess the module resolution mode at least explains why referring to the npm module in js works. I don't know, perhaps passing the source-paths to the closure compiler with --js would work
just used the file from the build dir, moved it to the examples folder and adjusted the path accordingly
but yeah .. use webpack or something for large JS codebases. that is not the focus of shadow-cljs
ok, yeah I considered doing that, i.e. dropping the three.js as npm dependency but I had of course started from that end and things in general worked well with shadow and npm deps
but no, I'd rather drop or rewrite the js dependencies in cljs than integrate the rest with webpack
i can’t find mention of this in docs, so either it’s undocumented or I imagine @U05224H0W you’ve decided against it? Building a react-native-web app and stumbled upon a module that isn’t transpiled 😓
export * from './SQLite';
^^^^^^
SyntaxError: Unexpected token 'export'
at Module._compile (internal/modules/cjs/loader.js:896:18)
the linked file is .js
and only includes export statements so pretty sure it’s just that the node_module needs to be compiled?
i’m going to be running into this a lot since not all react-native packages transpile their code. wondering how to best handle it
SyntaxError: Unexpected token 'export'
at Module._compile (internal/modules/cjs/loader.js:896:18)
ah yeah sorry, in this specific case it’s a node error - i’m trying to use expo-sqlite
in an electron app
shadow-cljs is not involved in loading the code then so there is nothing you can configure
:desktop-main
{:target :node-script
:output-to "apps/desktop/dist/index.js"
:main rf.app-desktop.main/start}
Hi, my build got recently broken on Windows 10 due to
Cannot run program "java" (in directory "M:\libs\myproject"):
CreateProcess error=206, The file name or extension is too long
which basically means that leiningen computes too many classpaths. I was googling little bit around and one suggested solution is to add plugin
[lein-classpath-jar "0.1.0"]
Which solves that problem but creates a new problem while compiling shadow-cljs release build. I am doing this in lein by
["run" "-m" "orgpad.build/release"]
whose code is the following
(ns orgpad.build
(:require [shadow.cljs.devtools.api :as shadow]))
(defn release []
(let [version (System/getenv "HEROKU_SLUG_COMMIT")]
(shadow/release :client {:config-merge [{:release-version version}]})))
But it fails with the error:
Warning: implicit hook found: lein-classpath-jar.plugin/hooks
Hooks are deprecated and will be removed in a future version.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See for further details.
[:client] Compiling ...
The required namespace "orgpad.client.core" is not available.
Compiling directly using shadow-cljs release client works fine. Any ideas what is wrong?@pavel.klavik looks like your sources just aren't on the classpath maybe?
if I remove that plugin, everything compiles fine, haven't done any changes to it recently
maybe you are activating different profiles? no clue what you whole setup looks like
Are you sure lines 3+ are related to the first 2? Because I have the same thing, and get the first 2, but not the rest @pavel.klavik
not really, it is something which always displays when I start java app, not sure what they mean
is it possible to use different plugins for different lein rules? so I could fix it for now by having it only on lein run, but not on lein uberjar?