Modules + meteor shell

Simple question. Say this is lib/collections.js.

export const Games = new Mongo.Collection('games');
export const Players = new Mongo.Collection('players');

Is there a way to access these in meteor shell?

1 Like

Yes, but it’s not obvious :slight_smile:

As in issue #6068, you need to replace the imports with require statements (and with top-level paths); to get access to the top-level require function, you need to call require = meteorInstall() once; make sure there’s no var before it so that you’re changing the global scope. So for your case:

require = meteorInstall();
var Games = require('/lib/collections.js').Games;
var Players = require('/lib/collections.js').Players;

Let me know if it’s not clear.