I want to include modularized files and, since I had experience
with NodeJS modules, I figured I would just need to add a few
to my program.
That’s not the case.
While NodeJS has a (relatively) simple
require() for appliction module
inclusion, the reigning solution on the browser side is RequireJS.
Coming from NodeJS’s implementation, RequireJS is a complex and confusing
wall of specifications. Using RequireJS means a different wrapper for
modules, a config specification for paths, shims, and whatever.
Sheesh. What’s all this stuff I have to learn? Why all the complexity? Why is there a whole new framework I have to learn in order to modularize my web page?
require()s and creates a single bundle to include in the web page.
This does solve part of the async loading problem but introduces a step that
would be different between developement and production.
The main difference between NodeJS’s
require() and RequireJS is that the
to do its thing while packages like RequireJS introduce a new level of abstraction and
complexity. Do I really need to learn a new framework in order to get asynchronous
loading? It seems so unnecessary.
Other people have wanted a simple
require() (my unhappiness is shared) and
they have created some alternatives.
Some discussion in Relation Between CommonJS and RequireJS
- uRequire is a converter that converts NodeJS modules and RequireJS modules into a common format