/require-mini

Requirejs-compatible library just in 200 lines

Primary LanguageJavaScript

require-mini Build

Tiny replacement of require.js powered by promises

Overview

It's library with require.js compatible API and full support of plugins. We are focusing on small size and use promises which are native in most browsers. Some of features we don't support for now, but most part of functions works properly. Look at examples in our tests.

Generally you can just switch from original require.js to our require-mini without any code modifications and will get advantage of lesser code which takes time to load. Documentation from require.js also applicable here.

Additionaly, because we are using promises, you will get support of asynchronus defines wihout any plugins

define('userData', ['fetch'], function(fetch) {
   return fetch('/api/profile');
});

Caveats

These features is not supported yet, but you can vote for its resolution

Getting started

via Bower

bower install require-mini --save

Differences to just-boris's repo

Newer build

  • Update some libraries
  • Some CommonJS support.

Changes

define('foobar',function(require,module,exports)) 

to

define('foobar',function(require,exports,module))

to make it same as in require.js

Gotchas

No relative paths! require("./foobar") is WRONG! Use just require("foobar")