• I've just been using exports = ClassName; which seems to be working fine.

    Yes, that's fine if you want just one class in a module.

    e.g. can more than one class exist in any one module? exports.ClassName = ClassName; exports.ClassNameDiff = ClassNameDiff;

    Yes, that's right. If you want two classes you can do it like that.

    Modules aren't particularly magic or clever - whatever is in exports after the module has executed is available when you then use require, so you treat it just like you would any other variable.

    I've seen in some of your code you do:

    exports = foo;
    exports = bar;
    exports = baz;
    

    But in that case, foo and bar get lost. After the code has executed, exports is equal to baz, so that's what gets exported.

About

Avatar for Gordon @Gordon started