browserify / commonjs-assert

Node.js's require('assert') for all engines
MIT License
295 stars 58 forks source link

Support UMD style by Webpack #16

Closed piecioshka closed 8 years ago

piecioshka commented 8 years ago

Hi @defunctzombie

I would like to use assert on my client side, but I use architecture in AMD style (with require.js). I this PR I am try to support umd style. Bump version to 1.3.1.

ScottFreeCode commented 8 years ago

Shouldn't this be 1.4.0 rather than 1.3.1 since the API now has direct browser support?

ScottFreeCode commented 8 years ago

On another note, this inspired me to take another shot at getting the same type of build working using just RequireJS's optimizer tool instead of pulling in WebPack. It's a bit more configuration, but after much fiddling around I managed to cook up something that seems to work ok. For comparison, here it is in a gist: https://gist.github.com/ScottFreeCode/64328d11c47ee4496f1c497b1067547d (To make it UMD rather than AMD, replace the top-level define call in build.start.frag with a UMD wrapper similar to what WebPack uses.)

(Unrelatedly, I'm not really sure, deployment-wise, if I should be generating sourcemaps for both minified and non-minified versions as I have it right now, or just generating sourcemaps for the non-minified version because the minified version is meant for production use where you wouldn't want the sourcemap anyway, or just generating a minified version and sourcemaps for it and ignoring the sourcemap in production so I don't have the extra non-minified version floating around but I can still see what's going on in development.)

defunctzombie commented 8 years ago

Sorry but I don't see a point to this. Using a tool like webpack, browserify, etc can easily create any standalone file you need for your projects. There are even hosted builders out there that will do it for you against any module in npm.

All this does is add a bunch of duplicated code to the repo and clutters the actual code.

piecioshka commented 8 years ago

You have right. Sorry.

@defunctzombie what kind of tool will build from browser version of any npm module?

defunctzombie commented 8 years ago

This one comes to mind https://github.com/jfhbrook/wzrd.in/blob/master/README.md

There may be others.

On Thursday, May 5, 2016, Piotr Kowalski notifications@github.com wrote:

You have right. Sorry.

@defunctzombie https://github.com/defunctzombie what kind of tool will build from browser version of any npm module?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/defunctzombie/commonjs-assert/pull/16#issuecomment-217159567