- 100% CommonJS modules 1.0 compliant (all unit-tests passed)
- 99% CommonJS modules 1.1.1 compliant (didn’t find any tests to verify)
- improved security (but I’m sure it’s still not bullet proof)
- correct relative path handling (the old version was buggy)
- support for module bundles (I love this ^^)
I tried to improve security a bit by preventing modules from accessing the internals of the require function and by making require a read only property of
window. I’m pretty sure this makes require() a bit safer, but I didn’t spent to much time on this topic to be sure.
Instead I spent several iterations on a feature I really wanted to have for the new require: Bundles (not packages). A bundle is a single file, which represents a directory with multiple modules. Hence multiple modules can be loaded with one HTTP request, which can reduce the network traffic significantly. But more on this later… Continue reading JS require() for browsers – better, faster, stronger