mattkrick / cashay

:moneybag: Relay for the rest of us :moneybag:
MIT License
453 stars 28 forks source link

UMD distribution #143

Closed dustinfarris closed 7 years ago

dustinfarris commented 7 years ago

This would be useful for me, maybe others who don't want to use browserify/webpack

mattkrick commented 7 years ago

you mean umd? i'm hesitant because it seems like everybody (including the upcoming ES spec) is using common js. can you lay out a use case?

dustinfarris commented 7 years ago

It's just that: avoid need for browserify which would simplify the build requirements my own library places on its users.

redux does this as well: https://github.com/reactjs/redux/blob/master/package.json#L30

and some reasoning here: https://github.com/reactjs/redux#installation

Recent Ember includes a nice way to import UMD from node_modules which would make life easier for me as a maintainer. All until Ember has a bona fide solution to importing CJS for the browser, which is in the works but who knows how far out.

mattkrick commented 7 years ago

ah gotcha, so all you really need is an script to build it?

dustinfarris commented 7 years ago

i think so. that way my users can pull in whatever specific version of cashay they want, and i'll just grab the UMD dist for the build.

This is how I'm doing it in ember-redux:

https://github.com/dustinfarris/ember-redux/blob/remove-browserify/index.js#L30

:point_up: that adds the UMD dist that redux provides to the projects vendor files, then Ember provides a way to transform it to an AMD named package so it can be imported:

import redux from 'redux'
dustinfarris commented 7 years ago

Found a broccoli-webpack plugin that can do this as part of my own build! We're cookin' with gas!