What JavaScript platforms currently support loading modules using RequireJS?

I am currently using MooTools, but I want to start some development by loading the RequireJS module. Is there any other infrastructure supporting loading RequireJS module out of the box? I heard that Dojo 1.7 will be, but it is still under development. Any other options? Thanks.

+4
source share
2 answers

You can add support for modules from any desired structure. If the structure does not have RequireJS support, you can make a wrapper file for loading the framework.

Zepto Example shell file:

 define(['lib/zepto'], function() { require(['lib/zepto']); return this.Zepto; }); 

In your application, you define a route for Zepto in a wrapper file and let it load lib.

Main application file:

 require({paths: { 'zepto': 'wrapper/zepto' } }); 

Thus, your application file structure will look something like this:

 main.js lib/zepto.js wrapper/zepto.js 

Thus, any infrastructure can support RequireJS, but you will need to write some shells for modules that have not added support for AMD loaders.

EDIT 07/07/2012:

RequireJS 2. + has a new function called shim that allows you to use any browser-based framework with it.

And a new feature for creating server-side shells other than AMD requires the offer of CommonJS templates.

+6
source

MooTools 2.0 does, validates a branch in the MooTools repository on Github.

+1
source

Source: https://habr.com/ru/post/1383260/


All Articles