I'm really puzzled by the enthusiasm around RequireJS. I've read up on it, I've built several large JS applications (~100 models, views, whatevers in ExtJS and Knockout), have been involved with a large BackboneJS/RequireJS application and am currently rebuilding a large site in AngularJS. AFAICT, RequireJS did not solve any problems that I had more easily solved with proper namespacing (yes, the feared global , e.g.…
Use this syntax, IMHO it's a LOT more readable: define(function(require) { var $ = require('jquery'), Handlebars = require('handlebars'), Backbone = require('backbone'), MyModel = require('mymodel'), MyControllerAnimals = require('mycontrolleranimals'); Also require.js comes with an optimizer that automatically concatenates all required files (and no more!) minifies them and you don't have to worry about script order…
Converting an existing Backbone.js project to Require.js
31–34 of 34 posts
Re: Converting an existing Backbone.js project to Require.js
#32Perhaps someone can clue me in, because I'm still at a loss for why there's so much hype built around Require.js. I develop JS primarily for the frontend, and I use Grunt, a global namespace, and concat (or similar tooling) to piece things together. Doesn't r.js execute dependency resolution code at run time? Can all references to r.js be fully compiled out? Even a wrapper like Almond seems to leave behind this kind…
I was thinking the same thing. Why would anyone want this?
The god-file approach to development leads to things like lots of search and replace when something needs renamed, name collision, and duplicated utility code everywhere.
Re: Converting an existing Backbone.js project to Require.js
#33Earlier quoted context omitted.
I was thinking the same thing. Why would anyone want this?
Because it's more costly to maintain 10000 line javascript files, you can start to reuse code at something smaller than the package level, you can have better cohesion and less coupling. The god-file approach to development leads to things like lots of search and replace when something needs renamed, name collision, and duplicated utility code everywhere.
"possibilistic" said dependency resolution must be done at compile time:
> I don't want any dependency resolution code in the production build, because that's a problem that needs to be solved at compile time.
Re: Converting an existing Backbone.js project to Require.js
#34Earlier quoted context omitted.
Because it's more costly to maintain 10000 line javascript files, you can start to reuse code at something smaller than the package level, you can have better cohesion and less coupling. The god-file approach to development leads to things like lots of search and replace when something needs renamed, name collision, and duplicated utility code everywhere.
Wtf, who said anything about a 10k LoC js file? "possibilistic" said dependency resolution must be done at compile time: > I don't want any dependency resolution code in the production build, because that's a problem that needs to be solved at compile time.