What's the new Application Structure for 1.7?


#1

After the release of Meteor 1.7 and this blog post:

Now we can use “meteor.mainModule” in our package.json to enable lazy loading in all the folders.
I quote: “In other words, you no longer need an imports/ directory”.

But what should our Application Structure look like ?
If we don’t need the imports folder, should we remove it ? Rename it ?

You can see an example of the old application structure with the imports folder in the documentation here: https://guide.meteor.com/structure.html#example-app-structure

I’m willing to start a new project and i want to start with the best structure :wink:

Thanks in advance


#2

My understanding is that with Meteor 1.7, we are now free to create our own folder structure that suit our project and our taste


#3

You can use the same structure. Just move everything in imports to the top level and declare a meteor.mainModule pointing to the start files of your application.


#4

I’m starting a green-field project with Meteor now. I’m using Meteor 1.7.1-beta.29. Of course I do not want to use the /imports directory. And I don’t want to eagerly load.

In order to not use the imports directory, I now have to specify a meteor.mainModule option in the package.json file like so?

{
  "name": "your-app",
  "dependencies": {...},
  "meteor": {
    "mainModule": {
      "client": "client/main.js",
      "server": "server/main.js"
    }
  }
}

And after this module loading will work like “other” non-Meteor projects?


#5

Yes that’s right.

That should be part of the scaffold for all new 1.7 apps via meteor create


#6

Thanks. It wasn’t. There was no “meteor” option in the package.json file. It was easy enough to add.