Skip to content
EEVV edited this page Apr 30, 2015 · 8 revisions

Bundles

Although the Readme.md (Guide) does say that bundles have to have an awkward work-around, it is actually false.

You can actually just require contents of another script, and it will bundle it within the binary. Like so;

    console.log("Initiating module...");
    var yourModule = require("./yourModule.js");
    yourModule.test();

And the contents of yourModule.js would be;

    exports.test = function test() {
        console.log("It worked!");
    };

The output is surprisingly;

    Initiating module...
    It worked!

Clone this wiki locally