This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-08
Channels
- # aws (21)
- # beginners (62)
- # boot (29)
- # chestnut (1)
- # cider (110)
- # cljs-dev (37)
- # clojure (93)
- # clojure-berlin (1)
- # clojure-dev (10)
- # clojure-greece (4)
- # clojure-italy (5)
- # clojure-new-zealand (1)
- # clojure-spec (6)
- # clojure-uk (46)
- # clojurebridge (1)
- # clojurescript (54)
- # cryogen (1)
- # cursive (22)
- # datomic (72)
- # emacs (2)
- # events (3)
- # flambo (1)
- # hoplon (88)
- # jobs (6)
- # juxt (51)
- # lein-figwheel (1)
- # leiningen (3)
- # lumo (12)
- # mount (4)
- # off-topic (3)
- # onyx (3)
- # pedestal (4)
- # portkey (27)
- # re-frame (13)
- # reagent (1)
- # ring (4)
- # rum (2)
- # uncomplicate (1)
- # unrepl (3)
Actually, I didn't see that we're in the clojurescript channel 😳 I can reproduce with clojurescript 1.9.660. Seems to happen with any arglist that includes a vararg.
hey guys, I've been trying to use new :npm-deps
feature and it mostly works, I can't figure out how to do something analogous to Browserify's .external
. Can someone help please.
when I do use (require '["enzyme/shallow" :as shallow]
in nodejs environment - it works, but when I switch to browser, it doesn't
it says Can't resolve 'react/addons'
, in Enzyme's documentation https://github.com/airbnb/enzyme/blob/master/docs/guides/browserify.md it said:
// make sure to mark these as external!
b.external('react/addons');
b.external('react/lib/ReactContext');
b.external('react/lib/ExecutionEnvironment');
Browserify is the opposite of using Node packages directly, so this guide is not relevant in this case
Browserify is needed if you use lib through :foreign-libs
And react/addons
is not found, because that file has been removed in React 15
that's right, it was removed, yet Enzyme still trying to require it (in case older version of React is being used). That's why they say to mark these
react/addons
react/lib/ReactContext
react/lib/ExecutionEnvironment
as "external", for browserify and webpackExternals are used when building JS for browser use
when React is provided by separate JS file
which is not the case when using Node packages
... or not, read their guide again
ugh, JS is crazy again
Cljs or Closure doesn't have option to ignore modules
>which is not the case when using Node packages
that's right. And it works for me when I do (require ["enzyme/shallow" :as shallow])
and run that in nodejs environment. But I really need the test run in a browser, headless or whatnot.
And I think it'll be hard to provide these modules yourself, as Closure won't look for Closure modules when doing Node dependency resolution
so you just can't provide empty react/addons foreign-lib or ns from Cljs
touch node_modules/react/addons.js
could work, though it is not very good idea to modify file in node_modules
I guess my only option is to use cljsjs strategy and "sift" it through webpack or browserify, so it can be used in a browser environment
so the bundler ignores these. How do I ignore deps in Clojurescript?
it's trying to require('react/addons')
, module I have to ignore it, but how?
How do you assign to a property in cljs?
I have a text input element
I want to clear its value
In JS I would do el.value = ""
(.-value el "")
doesn’t work since .-
only accesses properties
I thought maybe (.value el "")
would work, but it doesn’t either.
where el
is a dom element
nvm found the answer in cljs’ cheat sheet 😅
(aset el "value" "")
i think aset
isn't supposed to be used on objects (even though it currently works, i think that's an implementation detail that could change)
nevermind i figured it out, just as silly as i thought it would be....never code when tired
@thomaslp out of curiosity, what was it? Your snippet looks perfectly fine to me (except I never use :type :submit, always :button, not sure if there'd be a difference)
Was the error elsewhere?
Oh, not an FN!
Classic tired mistake
(I'm tired too)
If I compile clojurescript with compiler opts {:closure-defines {'my-app.setup/app-env "test"}
and :optimizations :simple
, I would expect the following to load my test config:
(ns my-app.setup
(:require-macros [my-app.config :refer [config]]))
(goog-define app-env "dev")
(config app-env)
But it loads the dev config, even though app-env
has the value "test"
!This is my last hope. I may be getting worse at googling. Is it possible to use /#/path
-style routes with bidi
? I got my first attempt working without the hash-based routes. But it's a bit problematic when you have an app anywhere else than on the root of the domain. Am I missing something?
@johanmynhardt on Cljs or Clj ?