Echo JS 0.11.0


sylvainpv 1795 days ago. link 1 point
If it's not hard, fork my lib and do it yourself :)
ifandelse 1791 days ago. link 1 point
Hah! If I could eliminate the need for this pesky thing called sleep, I'd gladly do it. Unfortunately, though, putting off sleep leads to an ever peskier thing called death. :(
Ash 1795 days ago. link 1 point
Is it really that straightforward, though? Making your CJS module compatible with AMD, or vice-versa, surely complicates your implementation. I have certainly experienced issues consuming cross compatible modules that just don't seem to be tested properly with my target module system.

I also assume (please tell me if I'm wrong) that by making my modules AMD compatible, I'm locked out from all of the dependency management goodness that comes with CJS and npm.

n.b. As somebody that has always steered clear of AMD, this is totally uniformed. The ambidextrous UMD approach sounds perfect, but really seems to complicate things. But I would love for someone to school me on my misconceptions (:
ifandelse 1791 days ago. link 1 point
All of my projects using the UMD-wrapper approach are published to npm, so it definitely does not stop you from publishing/utilizing it. Both postal.js and machina.js are examples of this. I can understand why using a UMD feels like it complicates things. I find it more annoying than complicating, personally. John-David Dalton (dev behind Lodash) had some great comments along these lines though when he was on the JSJ podcast - it's about helping developers. And having the ability to support CJS and AMD (in addition to plain globals) doesn't cost much in terms of effort or code, and the resulting win for you and people using your project is worth it, IMO.
Ash 1786 days ago. link 1 point
Ah yes, I remember that episode of JSJ. UMD makes perfect sense for something like Lodash, where ease of use and portability is really important, and (I don't think) external dependencies are involved*.

For most modules I've worked on, having npm manage dependencies, and being able to easily consume these is a huge advantage. As far as I can tell this approach doesn't work with UMD (again, please correct me if I'm wrong).

So I just don't see it as an approach I would want to use unless:

- Supporting all environments is critical
- The module doesn't have any external dependencies

I definitely lean in the direction – probably ignorantly – of just use CJS.

* I've only skimmed the Lodash source, I should take a closer look when I get the chance.
mxxx 1796 days ago. link 1 point
I wish more people would read this article. RequireJS allows you to use 'shim' directives to try and jimmy in support for non-AMD scripts, but it's really not difficult for people to bake in support for their modules.
ifandelse 1791 days ago. link 1 point
Thanks! I feel the same way. I was really glad when RequireJS added the shim feature. I used the heck out of it! I still use Require quite a bit, but recently started using Webpack as's just about sold me since I've been able to grab both AMD and CJS modules and use them with no fuss.