How about ClojureScript and CommonJS now?

498 views
Skip to first unread message

Jiyin Yiyong

unread,
May 19, 2016, 1:04:21 PM5/19/16
to ClojureScript
Searched and read some pages on this topic,
https://github.com/clojure/clojurescript/wiki/Google-Summer-of-Code-2015
https://github.com/clojure/clojurescript/wiki/Compiler-Options#foreign-libs
as a Webpack user I used them quite open. How about CommonJS support now?

* Can I require commonjs file?
* Can I use commonjs packages?
* ES6 is starting to taking over the JavaScript world, does cljs compiler recognise import and export?

Jiyin Yiyong

unread,
May 19, 2016, 2:02:16 PM5/19/16
to ClojureScript

Took me long time to find this piece https://github.com/mrmcc3/boot-rev

Leon Grapenthin

unread,
May 21, 2016, 8:39:49 AM5/21/16
to ClojureScript
My workflow is to compile all foreign JS I use to a single UMD file via webpack. It's maybe not perfect but it works reliably. Also whatever JS libraries are shared by the different foreign JS libraries are only included once.

Dustin Getz

unread,
May 22, 2016, 11:38:32 AM5/22/16
to ClojureScript
I use webpack as well for npm ecosystem interop, really the only annoying bit is shimming out cljsjs from all cljs deps which sometimes involves forking.

Herwig Hochleitner

unread,
May 22, 2016, 2:08:31 PM5/22/16
to clojurescript
2016-05-22 17:38 GMT+02:00 Dustin Getz <dusti...@gmail.com>:
I use webpack as well for npm ecosystem interop, really the only annoying bit is shimming out cljsjs from all cljs deps which sometimes involves forking.

I also use webpack to include npm packages. It's working, but I'd love to see / help with work to take advantage of the CJS support, that went into closure compiler as part of the last GSOC project: https://github.com/clojure/clojurescript/wiki/Google-Summer-of-Code-2015


Leon Grapenthin

unread,
May 22, 2016, 3:45:16 PM5/22/16
to ClojureScript
On Sunday, May 22, 2016 at 5:38:32 PM UTC+2, Dustin Getz wrote:
> I use webpack as well for npm ecosystem interop, really the only annoying bit is shimming out cljsjs from all cljs deps which sometimes involves forking.

@Dustin you can provide those deps using synthetic namespaces. E. G.

:foreign-libs
[{:file "foreign-js/main.js"
:provides [;; Fake "synthetic namespaces
"cljsjs.react"
"cljsjs.react.dom"
"flibs.react-bootstrap"]}]

Dustin Getz

unread,
May 22, 2016, 3:49:50 PM5/22/16
to clojur...@googlegroups.com
oh wow i didnt know about that thanks


--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/vMKCS-p6fcs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Dustin Getz

unread,
May 22, 2016, 3:51:35 PM5/22/16
to clojur...@googlegroups.com
Is there a way to subtract out a namespace? For example Promesa bundles Bluebird (npm js dep), but i need promesa to come through my own npm toolchain so it is visible via require, so i had to fork promesa to remove the deps.cljs https://github.com/funcool/promesa/blob/master/assets/deps.cljs

Andrey Antukh

unread,
May 23, 2016, 1:33:15 AM5/23/16
to clojur...@googlegroups.com
Hi

promesa author here

I think you should treat promesa bundled bluebird as implementation detail, so if you want access to bluebird on your js code, just use your own dependency on the js side. 

I think that you are targeting nodejs so having two "different" versions of same library it is not a problem in my opinion.
Maybe I'm supposing too much or I'm missing something...

Regards.
Andrey

You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.

To post to this group, send email to clojur...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.



--
Andrey Antukh - Андрей Антух - <ni...@niwi.nz>

Jiyin Yiyong

unread,
Jun 2, 2017, 12:32:46 AM6/2/17
to ClojureScript


On Friday, May 20, 2016 at 1:04:21 AM UTC+8, Jiyin Yiyong wrote:

Jiyin Yiyong

unread,
Sep 1, 2017, 1:14:59 PM9/1/17
to ClojureScript
For reference, if you want to compile ClojureScript into CommonJS code and bundle it with Webpack, check this out https://hashnode.com/post/early-stage-live-coding-clojurescript-with-webpack-cj2w4lsiv006ul7k8rcp9bqvd


On Friday, May 20, 2016 at 1:04:21 AM UTC+8, Jiyin Yiyong wrote:
Reply all
Reply to author
Forward
0 new messages