Hey everyone!
So, as the title says I’m slightly confused about the file load order (rules) / application structure when using Meteor combined with Angular (2). I already opened a thread on reddit, but I thought it won’t hurt anyone if I ask my questions here again.
I was reading the file structure portion of the meteor guide and was wondering how all of that (special folders, file load order) affects an app written with Meteor + Angular (2). So I looked up the file structure section of the Angular-Meteor tutorial. There it says:
As you have probably noticed, our tutorial app has a strict modular structure at this point: there are no pure JavaScript files that are being bundled together and auto-executed, so Meteor’s file loading conventions doesn’t have any effect.
Alright, makes sense I guess, since we’re using TypeScript. Then it (in the Angular-Meteor tutorial) goes on to say:
There are several load order rules. They are applied sequentially to all applicable files in the application, in the priority given below:
- HTML template files are always loaded before everything else
- Files beginning with main. are loaded last
- Files inside any lib/ directory are loaded next
- Files with deeper paths are loaded next
- Files are then loaded in alphabetical order of the entire path
Uhm, o-o-okay. A couples lines above they said “file loading conventions” had no effect!? Obviously those special folders (like /client/, /server/,…) still have an effect, so that’s not what they are talking about.
And as if that wasn’t confusing enough, the Angular-Meteor tutorial goes on to use examples with files .js-extensions (which is most likely c&p from the official meteor guide).
So, I guess my questions are the following ones:
-
What do they precisely mean when they talk about “file loading conventions” that have no effect?
-
I understand that my .ts-files are being compiled into CommonJs-modules. What happens to those modules?
I guess it would help if someone could outline how the process exactly looks. How does Meteor load files in that specific (Meteor + Angular 2) environment? Also, I’m not trying to meddle with anything here, I’m just trying to understand what happens.
Thanks in advance, I appreciate any help I get!
E:
Another question just popped up: What’s the effect of the imports/-folder - or rather for the files within those folders -, considering the following structure:
-some_folders/
-both/
—collections/
—methods/
—models/
-client/
—imports/
------somefile.ts
------somefolder/
---------somefile.ts
—main.ts
-server/
—imports/
------somefile.ts
------somefolder/
---------somefile.ts
—main.ts