Using RequireJS exports with CoffeeScript

If you are using the “exports” object in your RequireJS module definition and happen to also be using CoffeeScript then be careful to either return the exports object at the end of the function or explicitly return nothing from the function by typing “return” on the last line. Like so:

define((require, exports, module) ->
    exports.foo = 'bar'
    return
)

If you don’t return nothing or the exports object CoffeeScript will compile this:

define((require, exports, module) ->
    exports.foo = 'bar'
)

…to the following javascript:

define(function(require, exports, module) {
    return exports.foo = 'bar';
});

Where the return value will be the string ‘bar’. This is no good because if you return a value from your module definition function, RequireJs uses it instead of the exports object. So when you come to require your module, you’ll be passed a String, rather than an object with a “foo” property as you’d expect.

18,266 thoughts on “Using RequireJS exports with CoffeeScript

  1. A small first payment can give players a more comfortable entry inhto the experience.
    At an online casino with minimum deposit, users can beggin without unnecessary pressure.
    Many players aloso appreciate simple deposit instructions, comfortable account features,
    and aan easy overall flow. As a result, there is a well-balanced experience.

  2. In 2026, WhatsApp marketing at scale demands more than raw accounts — it requires whatsapp hash channels.

    These specially formatted sessions let automation tools send bulk messages
    without QR code logins, dramatically reducing detection risks.
    The whatsapp wart extractor is the industry-standard
    whatsapp hash channel creator that converts any WhatsApp account into ready-to-use hash channels in seconds.

    This guide explains everything: the whatsapp hash channel 6 segment format, step-by-step conversion, how to buy whatsapp hash channels safely, and proven whatsapp hash channels anti ban tactics that keep accounts alive for months.

  3. El portal Deporte Ecuador se presenta como un sitio especializado enfocada en el estudio
    del entorno deportivo digital en Ecuador. El sitio reúne contenidos que examinan el desarrollo
    del deporte ecuatoriano en relación con la tecnología, la data y las tendencias de
    uso actuales.
    A diferencia de los sitios convencionales, Deporte Ecuador
    no se limita a cubrir resultados o noticias. Su enfoque está en interpretar
    el comportamiento del entorno deportivo contemporáneo: el modo en que los
    usuarios usan las plataformas, qué elementos determinan su comportamiento y cómo evolucionan los
    estándares de calidad online.
    El material de la web se presenta bajo varios pilares principales.
    En primer lugar, se evalúan las plataformas deportivas desde el punto de vista del usuario, su solidez y continuidad.
    Además, se revisan tendencias del mercado,
    procesos de digitalización y evolución del
    consumo deportivo en el país.
    Además, el portal también cubre cuestiones
    regulatorias, la seguridad digital y la toma
    de decisiones dentro del entorno online. Gracias a ello, se obtiene
    una perspectiva más integral del ámbito deportivo, combinando análisis técnico, contexto local y conducta del usuario.

    El propósito central es brindar datos claros, bien estructurados y funcionales para interpretar el deporte en el entorno
    digital actual. No pretende reducir el análisis a explicaciones básicas,
    sino de ayudar a interpretar un entorno cada vez más complejo.

    El portal está orientado a lectores that desean profundizar más
    allá de la información superficial: desde su dimensión tecnológica y
    cómo influye en la vida diaria.
    El texto menciona que hay un enlace disponible para ampliar el
    artículo.

  4. Interesting blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple tweeks would really make my blog shine.
    Please let me know where you got your design. With
    thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>