requirejs README

The project's README from github.com/requirejs/requirejs. As one markdown file: README.md.

RequireJS

RequireJS loads plain JavaScript files as well as more defined modules. It is optimized for in-browser use, including in a Web Worker, but it can be used in other JavaScript environments, like Rhino and Node. It implements the Asynchronous Module API.

RequireJS uses plain script tags to load modules/files, so it should allow for easy debugging. It can be used simply to load existing JavaScript files, so you can add it to your existing project without having to re-write your JavaScript files.

RequireJS includes an optimization tool you can run as part of your packaging steps for deploying your code. The optimization tool can combine and minify your JavaScript files to allow for better performance.

If the JavaScript file defines a JavaScript module via define(), then there are other benefits RequireJS can offer: improvements over traditional CommonJS modules and loading multiple versions of a module in a page. RequireJS also has a plugin system that supports features like i18n string bundles, and text file dependencies.

RequireJS does not have any dependencies on a JavaScript framework.

RequireJS works in IE 6+, Firefox 2+, Safari 3.2+, Chrome 3+, and Opera 10+.

Latest Release

License

MIT

Code of Conduct

jQuery Foundation Code of Conduct.

Directories

Tests

This repo assumes some other repos are checked out as siblings to this repo:

git clone https://github.com/requirejs/text.git
git clone https://github.com/requirejs/i18n.git
git clone https://github.com/requirejs/domReady.git
git clone https://github.com/requirejs/requirejs.git

So when the above clones are done, the directory structure should look like:

You will need to be connected to the internet because the JSONP and remoteUrls tests access the internet to complete their tests.

Serve the directory with these 4 siblings from a web server. It can be a local web server.

Open requirejs/tests/index.html in all the browsers, click the arrow button to run all the tests.

requirejs (requirejs/requirejs)

Searching Database…

12.9K ·GitHub
What is this?RequireJS is a file and module loader for JavaScript, optimized for use in the browser (including Web Workers) but also usable in environments like Rhino and Node.
Is this a build tool or something I load at runtime?It's primarily a runtime script loader that uses plain script tags to load modules/files, plus it bundles an optimization tool you run during your build/packaging step.
How do I add it to an existing project?You can drop in require.js and use it to load your existing JavaScript files without rewriting them, or define new modules with define() for extra benefits.
Does it depend on any other JS framework?No, RequireJS has no dependencies on any JavaScript framework.
What browsers does it actually support?It works in IE 6+, Firefox 2+, Safari 3.2+, Chrome 3+, and Opera 10+, so support is aimed at older/legacy browsers rather than the latest-only standards.
What module format does RequireJS implement?It implements the Asynchronous Module Definition (AMD) API, letting you use define() to declare modules with dependencies.
What extra features do modules get with define()?Modules defined with define() get improvements over traditional CommonJS modules and the ability to load multiple versions of a module on the same page.
Does it support things like i18n or loading text files?Yes, RequireJS has a plugin system supporting features like i18n string bundles and text file dependencies.
How do I run the test suite?Clone the sibling domReady, i18n, and text repos next to this one, serve the combined directory structure with a web server, and open requirejs/tests/index.html in a browser to run the tests.
What are similar projects?webpack, lodash, uppy, PhotoSwipe, q, vue-resource, jsoneditor, browserify
Creator
requirejs
Size
14.5 MB
Stars
12.9K
Updated
CommitNov 30
Age
16y
Commits · 90 Days