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
Description
... 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
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
jmesserly commentedon Aug 16, 2016
https://codereview.chromium.org/2249233002/, I opted for using an explicit deps array to avoid having requirejs parse the body to find
require