How to solve the situation with the right way, when we are sharing common src between two meteor apps (we dont want tu use a private Npm/Atmosphere repo, but we are using a git submodule).
Currently, we created a /common folder (git submodule) in Meteor project root and inside common we have following file structure:
/common
/client
/server
/both
Does exists any way to prevent, If developer make a mistake and import code from /common/server into client?
Question2:
If I will make a mistake, and I will import server code into client. But the server code I will wrap into “if(Meteor.isServer) { …some code}”
After build the application, the server code will be will be physically present after compilation on client side or not?
If I remember correctly Meteor distinguishes the /server, /client folders in root, so in your case where everything is behind /common folder it can’t prevent accidental inclusion on client. That is something you will have to catch.
As for your second question I’m not sure if that is currently working or not. I think it will be that way in Meteor 2.0, but @renanccastro will probably know better.
Yes, any folder with /server/ in it’s path will be excluded from the client.
So /common/server will be excluded from the client, as will foo/server/bar