Why the magically named folders and files?

Excuse the noob question, but why does Meteor have magical files and folders?

Eg, if you put something in the client/ folder, it loads only on the client. If you put something in the server/ folder, it loads on the server. If you put it in the imports/ folder, it doesn’t even load.

Am I the only person that thinks this seems a little too… magical? It’s not really terribly logical, it’s just a piece of knowledge that does not appear to be overrideable. Why not just specify entry points in the package.json? Eg:

{
  "name": "my-package",
  "main": {
    "client": "client.js",
    "server": "server.js"
  }
}
1 Like

Meteor 1.3 is a bit of a hybrid version: it still loads all the files in client and server, but also allows the new import option. Meteor 1.4 will probably lose the client and server folders and require you to use imports.

Before Meteor 1.3 there was no package.json, no loading npm modules, etc.

If you take a squiz through the forums, you’ll also see how incensed some people are that the official recommendation is to now use imports. I guess the magic is hard to give up once you’re used to it, nevermind advantages of clarity, optimization, testing and hotloading.

But yes, before the days of imports and modules, this was a really great feature. Until you had a big code base, and had to either go through hoops in naming your files to get the right load order, or (what most people did), divide your app into lots of mini packages to get the same functionality.

2 Likes

what ??? no more eager loading ?