Module system for Meteor


Let me introduce you fragments. It’s a simple module system for Meteor.

What? Yet another module system?

Well… yeah. For today, Meteor does not play well with any kind of modules (es6/amd/commonjs). Fragments are not better than other module systems. Fragments will be deprecated someday. But for now it’s a very easy-to-use solution for Meteor.


  1. Easy-to-use
  2. No matter files load order
  3. No global variables


There is object modules:

// modules == {}

Register module foo:


// modules == { foo: {} }

Define some field for foo module:

f('foo', function() { = 'baz';

// modules == { foo: { bar: 'baz' } }

Now let’s create another module, which uses foo's bar field:

f('foo', function() { = 'baz';

// Use `` as `bar` variable
f([ '' ], function(bar) {
  console.log(bar); // => 'baz'

NOTE: modules is not in global scope! You can’t use modules variable.

That’s all you need to know to get started.

If you are interested, you can read more on github: