3 ms·
RequireJS is very expensive and it's NOT CommonJS. It claims that CommonJS is not-optimal for browser and offers you to put your source code inside of an awkwar
by combataircraft 14y ago
RequireJS is very expensive and it's NOT CommonJS. It claims that CommonJS is not-optimal for browser and offers you to put your source code inside of an awkward container for optimizing. It's not smart.
Let me introduce you OneJS: http://github.com/azer/onejs http://github.com/azer/onejs
It simply converts any CommonJS package into a single, stand-alone JavaScript file. It means, you can structure your client-side project just like a NodeJS project and you can convert your NodeJS project to a single file just like a client-side project.
Unlike Browserify, OneJS is unobtrusive [1], provides an accurate implementation of CommonJS specs [2] and the output it produces is suitable for splitting and having async dependencies.
[1] A chess website built with OneJS: http://multiplayerchess.com/mpc.js http://multiplayerchess.com/mpc.js
[2] ExpressJS built with OneJS, with all dependencies: https://gist.github.com/2415048 https://gist.github.com/2415048
- stephan83 14y agoThat looks cool, will look into it. Does it support the http node core module, like browserify?
- combataircraft 14y agoHere are the core modules it supports; http://news.ycombinator.com/item?id=3915403 http://news.ycombinator.com/item?id=3915403 browserify-http can be used by OneJS as well but I don't see any point of emulating http module on client-side. I prefer using libraries supporting both platforms, such as boxcars; http://github.com/azer/boxcars http://github.com/azer/boxcars