macchiato-framework / macchiato-core

Ring style HTTP server abstraction for Node.js
MIT License
377 stars 35 forks source link

Is it possible to use NPM modules on the client side? #23

Open derekchiang opened 6 years ago

derekchiang commented 6 years ago

Is it possible to use NPM modules on the client side? If so, is there an example for it?

yogthos commented 6 years ago

Should work the same as server-side if you include them under :npm {:dependencies [...]}. There isn't an example available, but you can make a new project with the client-side support by adding the +browser flag thanks to this pr by @nenadalm.

nenadalm commented 6 years ago

@derekchiang I was playing with it yesterday and sometimes you need to create single file first: http://blob.tomerweller.com/reagent-import-react-components-from-npm.

There should be support for it in clojurescript: https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules but it's not finished yet (I was trying it with newest beta of http://www.material-ui.com/#/ and I wasn't able to configure it so that it would work. It was working only by using webpack as described in the first link).

nenadalm commented 6 years ago

@derekchiang also I don't know if you're aware of https://cljsjs.github.io/ - it contains some js libraries packaged and ready for clojurescript.

yogthos commented 6 years ago

shadow-cljs is also worth looking at for this

lilactown commented 6 years ago

Yeah, my team has migrated to using shadow-cljs specifically because of it's much better consumption of NPM modules.