Hey guys, nice work with 1.3, itās a lot of little things that are going to make the overall developer experience a lot smoother. Iām reading through the guide now and had a couple of questions about this section, namely:
###1. Relative import paths
I found relative paths in the examples that have more than one āfinding the parent levelā, i.e. ../../
hard to follow. In past experience with React projects Iāve also found these tedious to maintain and at certain times difficult to reason about.
I can see a benefit in using relative paths because Iām assuming in future we will be able to move everything from imports/
into the projectās base directory (as one example). At that point weād have to update a lot of individual files though if weāre using absolute paths, which would be a pain for version control.
I have used Broccoli in the past, which allows you to set a root directory for import
statements in the brocfile (basically a project settings.js
). So Iām wondering whether a similar option would be possible for Meteor: for now set the base import folder to /imports
. Then from your routes.js
you could just import '/ui/template/pages/xyz.html'
, and when the hypothetical Meteor 1.4 comes out and forces everyone to switch to the new imports pattern (making /imports
redundant), we could just kill the that directory and change the import root in one line of code.
###2. Clarity about what to import
I found this sentence in particular unclear:
The imports/startup/client/routes.js
configures all of the routes and then imports all other code that is required on the client, forming the main entry point for the rest of the client application
My intuition tells me that importing āall other code that is required on the clientā is not actually what youāre suggesting. In any case I had to read the section three times to figure out what you really mean. Iām still not sure why importing anything close to āallā code in the router would be advantageous, and what really needs to be imported.
My understanding is that after the (eagerly loaded) startup, the router ā for all intents and purposes ā forms the āroot nodeā of the app, from which other files are, at least in principle, lazily loaded. So it makes sense for the router to know about other layouts and pages that are directly accessible via routes. Is that the extent for files that should be imported here, or have I missed something?