I was wondering, when using
import vs the normal
server/ directories.is there any performance difference during production [I don’t think there should be any] or during development with changes [not sure but it seems to have some difference].
The reason I am asking…
is when I look at the structure i was working with, I noticed there are a few modules that I would have to import and I keep on having to list them manually and repeating myself to manage it.
The most major advantage I can see with imports is I can turn modules on and off rather than deleting or moving them. The bad side effect of this one is I may not know which files are not even imported and can be removed.
The advantage of the drop on the spot is you don’t have to deal with explicit imports, but you have to make sure you know the order things are loaded.
I use a combination of both, individual components which I would have to import anyway because I use ESLint and have configured that I need to declare any variable/class/object I would use. Examples of this are ReactJS components, Angular modules, routes?, collections.
The two criteria where I would choose to put into imports are
- it needs to be imported by other modules
- it has an
export(including Angular HTML templates that now export the
templateUrl, thanks @Urigo )
Then I have those that do not export anything I put into client or server.
Though after doing the ReactJS version of my boilerplate, I was thinking that for a Meteor project the routes (assuming I am using flow-router) should just be in
/routes/ as it is used in both client and server. Though I also thought if I had a large application, I may want to keep it as an import and manage it using an
index.js file so I can turn routes on and off as needed.