Download RequireJS
Latest Release: 0.12.0
- A new plugin: order -- it ensures that scripts are fetched asynchronously and in parallel, but executed in the order specified in the call to require(). Ideal for traditional browser scripts that do not participate in modules defined via calls to require.def().
- Web Worker support. RequireJS can be used in a web worker.
- Multiple module names can now be mapped via the paths config option to the same URL, and that URL will only be fetched once.
- Added Firefox 2 to supported browsers. Safari 3.2 also works with require().
- Bug fixes (see commits starting from 2010-05-25 through 2010-07-04), in particular a fix for the priority config, and improved support in IE with a bad base tag.
require.js Minified | With Comments
All you need to start using require.js in the browser. Does not include i18n, text, order, JSONP plugins or Node/Rhino support.
require.js with plugins Minified | With Comments
require.js for use in the browser with the i18n, text, order and JSONP plugins included.
require.js with Transport D and plugins Minified | With Comments
require.js for use in the browser with require.define support for Transport D from CommonJS, and i18n, text, order and JSONP plugins included.
jQuery 1.4.2 with require() Minified | With Comments
A build of jQuery with integrated require() support. Just includes the basic RequireJS, does not have the following features:
- i18n, text, order, JSONP plugins
- multiversion support
- page load support (it is assumed you will use jQuery's methods)
- require.modify() support
jQuery 1.4.2 with require() and plugins Minified | With Comments
A build of jQuery with integrated require() support and the i18n, text, order and JSONP plugins. Does not include these other RequireJS features:
- multiversion support
- page load support (it is assumed you will use jQuery's methods)
- require.modify() support
The integrated builds with jQuery contain the changes in this jQuery fork.
Sample jQuery 1.4.2 project with require() Download
A zip file containing a build of jQuery with integrated require() support, with an sample project included to show how it can be used when using jQuery. Does not include these features in RequireJS:
- i18n, text, order, JSONP plugins
- multiversion support
- page load support (it is assumed you will use jQuery's methods)
- require.modify() support
RequireJS adapter for Node
r.js: use this file if you want to code to the RequireJS module format in Node. The Node instructions explain how to use it. It includes all the code needed for RequireJS to function with Node.
index.js: the standard HTTP server-based Hello World app for Node, but coded to work with the r.js adapter. Download it in the same directory as r.js and then run this command:
node r.js index.js
Then you can go to http://127.0.0.1:8000/ and see "Hello World" printed after about 2 seconds.
Optimization Tool / Full Source Download
A zip file that is the optimization tool for RequireJS. It also includes the full source for require.js and its plugins.
If you want to use RequireJS in Rhino, you should use this download.
Previous releases
Latest Release: 0.11.0
- There is a new priority config option to indicate priority, parallel download of build layers.
- A new JSONP plugin allows you to treat any JSONP service as dependency.
- require.js should be Caja-compliant. The plugins may not be, but the main require.js file passed cajoling on http://caja.appspot.com/.
- Instructions and optimization support for renaming require().
- There is a new RequireJS+Transport D download option that supports the CommonJS Transport D proposal. This can be useful in conjunction with the server-side Transporter project.
0.10.0
- RequireJS works in Node.
- Optimization tool enhancements:
- For a given module, you can now use exclude to exclude some modules and their nested dependencies.
- Use excludeShallow to just exclude a specific module, but still include its nested dependencies. This is particularly useful during development. You can do an optimized build, but just excludeShallow the current module you are developing/debugging to get fast dev load times, but still allow easy debugging and development.
0.9.0
- Optimization tool refactored and improved
- Basic CSS optimizations are in! @import urls are inlined (with url() paths properly adjusted), and comments are removed.
- Robust nested dependency tracing by use of an AST. As a result, the build option execModules is false by default now. This is what most people need, so it is no long necessary to include execModules: false in your build profile.
- Now possible to build just one JS file or one CSS file at a time, no need for a build profile! See the Optimization docs for full details.
- Backwards incompatible change: the format of build profiles has changed. It no longer uses require() calls but it is a completely declarative format. This should be more robust for the future, and it allowed for a cleaner refactoring of the optimization tool.
- Support for relative module names in require.def dependencies
- require.def("my/project/module", ["./dependency1"], function(){}); will now load my/project/dependency1.js. This should help cut down the amount of typing for larger projects.
- The first argument to require.def, which gives the name of the module being defined, still needs to be a full name. It cannot be a relative name (cannot start with a . or ..).
- require.nameToUrl() does not accept relative names.
- Backwards incompatible change: text! plugin URLs now use . instead of ! for the file extension. So, instead of "text!some/module/sample!html" it is now "text!some/module/sample.html". Please update your code, the old !html will no longer work.
- Bug fixes
This release has a couple backwards incompatible changes. These kinds of changes will be generally avoided, and more notice via the RequireJS mailing list will be given if it needs to happen again. RequireJS has not reached 1.0, so these kinds of changes may still happen. However, there should be less of a need for a backwards incompatiable change now, and as of today, none are forecasted.
0.8.0
- Renamed from RunJS to RequireJS
- Adds better support for existing JS files
The previous releases were just different stages in the source tree. Here are the release notes for those versions.
0.0.7
- Separate module definitions via a require.def() function.
- Reworked module loading code based on Rawld Gill's algorithm.
- Changed i18n bundles to just list locales with true, based on a suggestion from Adam Peller.
- Integrating feedback from Bryan Forbes/David Mark.
0.0.6
- Removed the Function specifier. That was for circular dependencies, but due to concerns about identity, decided to not support that use case. Now, a module function can return any value it wants to define itself, can be Function, Object, String, Number, Boolean, whatever. And now, for circular dependency, the circular dependency will be null. I decided not to throw in that case because I wan require to be able to load existing code that does not call back to require to define a module. To support circular dependencies, the module function can use require() to fetch that circular dependency later, outside the circular dependency loop.
0.0.5
- Introduce plugin concept for require.js. i18n code moved to a plugin.
0.0.4
- pause/resume for build layers
0.0.3
- Module modifiers
- Better function module support
- Allow require() calls that just have a config object.
0.0.2
- Allow modules to be defined with a plain object instead of a callback.
- i18n bundle support.
0.0.1
- Basic module loading
- Support non-requirejs module loading, if file ends in .js
- Supports loading modules with different versions by using context names in top-level require() calls.