Open perbergland opened 3 years ago
Are you using mainModule config on package.json in your apps or just using client / server directory names to coordinate the importing?
I'm asking as this would affect the warning implementation.
Also, in your case, it caused you to spend a lot of time or did you realize the mistake when you saw the error?
Ah yes, good question. We currently just rely on client/server/imports directory name conventions since it has worked well so far ("if it ain’t broke don’t fix it").
I believe we need to define better what would be the warning implementation here so we could classify this request as ready.
I don't know exactly what would be the best way to implement it, just checking the folder name could be a weak check.
Usually when I have important files that somehow are shared but they shouldn't be imported on client I throw an error inside a if (Meteor.isClient) in the top of the file.
I just killed our app by including a module from /server into a /client module and then of course that module can’t be loaded in the browser (javascript error in runtime).
It would be a nice safety net if this was detected by the import/require scanner in meteor build tools and reported as an error.