{This has nothing to do with Twitter}
Bit of an interesting question, interesting in that its probably stupid and you can laugh but I will have at least an answer to this damn itch.
Currently I use
var Bootstrap = require('library/Bootstrap');
Bootstrap.run();
When what would be really great is if I could do something like this in the Bootstrap index.js
module.exports.Bootstrap = My_Bootstrap;
And call it willy nilly like this
require('library/Bootstrap');
Bootstrap.run();
Without having to declare another variable to my space, is there a way to do this or am I staring at a screen wondering, dreaming, getting lost, coming back and wasting time?
edit
So this is what I did in the end:
I created a single global object and am only adding important modules to it so they can be accessed and instantiated. This turned out to be an amazing answer and solution and really handy
Well you can just modify the
globalobject. This is similar to window object on browsers. So you can write a wrapper for your module like the following:The global object is shared between modules. Then you can just use with
Bootstrapwherever you are.