This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-05
Channels
- # announcements (13)
- # aws (1)
- # bangalore-clj (4)
- # beginners (66)
- # boot (11)
- # calva (27)
- # cider (27)
- # clj-kondo (76)
- # cljdoc (6)
- # cljs-dev (38)
- # clojars (3)
- # clojure (143)
- # clojure-dev (2)
- # clojure-europe (6)
- # clojure-greece (10)
- # clojure-italy (10)
- # clojure-nl (5)
- # clojure-norway (2)
- # clojure-sweden (1)
- # clojure-uk (19)
- # clojurescript (49)
- # cursive (13)
- # datomic (14)
- # duct (6)
- # figwheel-main (3)
- # fulcro (31)
- # funcool (7)
- # jobs (3)
- # keechma (142)
- # liberator (1)
- # off-topic (15)
- # om (2)
- # reagent (1)
- # reitit (2)
- # remote-jobs (1)
- # rewrite-clj (73)
- # shadow-cljs (21)
- # spacemacs (18)
- # sql (5)
- # tools-deps (10)
- # yada (1)
Hi @dnolen, I'm seeking your opinion please: When running cljs on node, and doing a require of a foreign lib, the foreign lib script is run even if that foreign lib ns has been required before. IOW foreign lib requires appear to work differently to regular ns requires. does this sound like a bug to you? There's more context about the particular reason this is causing me a problem here: https://github.com/clojure/clojurescript-site/issues/320
@henryw374 sidenote, you should file issues in JIRA not the GitHub issues for the website
@henryw374 but reading over that - there is no bug
seems like an issue w/ how you're trying to use random foreign-libraries, nothing specific to the foreign library feature in general
There is a red note box at https://clojurescript.org/reference/compiler-options#npm-deps
@dnolen so are you saying foreign-libs are not intended to work on node? re: why I need to bother. I am the author of a cljs lib that depends on a foreign-lib. in it's docs it says 'if you're using shadow, do xyz'. so update that to include node? And ideally detect if the foreign-lib is being used on node and throw Currently, it kind of works as-is on node rather than completely or not at all.
I didn't say that, I said what you're trying to do - there no magic way for that to work
libraries that must be consumed differently for different tools is not a good idea IMO
@henryw374 the real answer is to have better integration w/ tools that solve this problem for JS already
React can in fact probably be made to work - but I would consider it too expert of an option for most poeple
what Thomas Heller was trying to say in the issue was the CLJSJS in general assumes browser - because that what most users are doing
fair enough. in my case, it would work on node if the foreign-lib require executed the script once at most, but I accept that's not a generally a problem. I'll have a read to understand the proposal. For now my lib will continue to need workarounds
if you targeting the browser then support webpack build step and hide all the boring details
important thing - nobody is spending time packaging anything and potentially in the wrong way
ok cool. I need to read up more, but it sounds like the bottom line is that users of my lib will really need to have npm installed as a pre-requisite. Which seems reasonable, but inevitably that will put some people off I guess. It'd be interesting to know what proportion of cljs users that'd be