Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for System.register #60

Open
thgreasi opened this issue May 14, 2015 · 2 comments
Open

Add support for System.register #60

thgreasi opened this issue May 14, 2015 · 2 comments

Comments

@thgreasi
Copy link

As noted at es6-module-loader wiki:

System.register can be considered as a new module format...

How about extending the UMD pattern to also use System.register?
Something like:

if (System && typeof System.register === "function") {
    System.register(['b'], factory);
} else if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['exports', 'b'], factory);
} else if (typeof exports === 'object') {
    // CommonJS
    factory(exports, require('b'));
} else {
    // Browser globals
    factory((root.commonJsStrict = {}), root.b);
}

A similar discussion also takes place at mozilla/localForage#158.

@jrburke
Copy link
Member

jrburke commented May 14, 2015

For me, System.register is still speculative, and its format could change depending on how the loader API for the ES module loader shakes out. The use of System in general is trying to mimic or guess at the ES API, and it is just not close to done. I also expect the loaders that do implement System.register would know how to load commonjs or amd modules.

@EvanCarroll
Copy link
Contributor

Does anything support System.register?

$ node --version
v5.0.0
node --harmony_modules
> System.register()
ReferenceError: System is not defined
    at repl:1:1
    at REPLServer.defaultEval (repl.js:248:27)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:412:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
    at REPLServer.Interface._line (readline.js:549:8)
    at REPLServer.Interface._ttyWrite (readline.js:826:14)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants