Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

implement requirejs module format #626

Closed
@jmesserly

Description

@jmesserly

... to replace our "legacy" one. We don't have to remove legacy yet but this opens the door.

The reason to support both RequireJS and CommonJS (our "--modules=node" format) is that RequireJS is to offer more options & compatibility, and require is a wee bit more friendly for browsers (as the code is already wrapped in a "define", the script can be executed directly).

http://requirejs.org/docs/start.html
here's an example app
https://github.com/volojs/create-template/tree/master/www

it looks roughly:

define(function (require) {
    // Load any app-specific modules
    // with a relative require call,
    // like:
    var messages = require('./messages');

    // Load library/vendor modules using
    // full IDs, like:
    var print = require('print');

    print(messages.getHello());

    // exports are returned here
});

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions