I asked this question about sharing code between Node apps yesterday with no answers, so now I have a more specific question instead of long-rambling one.
Is it considered a bad practice to add require paths to NODE_PATH?
As I mentioned in my previous question, I'm struggling with finding a way to share common assets between two node apps, and the only sensible solution I could come up with is using git submodules. I would place this submodule, containing common assets such as Mongoose schemas, to the both apps' root, update the files when necessary and then push 'n pull it over to the other app. It's a very simple process with no serious merging problems with the apps' own files like in the third solution I thought of in my original question.
The beauty of this structure would be that I could require those common assets with just folder/file.js
instead of submodule/folder/file.js
by adding the submodule path to Node's require paths. This would also mean that I could overwrite the submodule's common files with the app's own respective files (if they existed) by placing the submodule path further on the path stack, so that if a local file was found, node would require that instead of the submodule's equivalent.
But there's one tiny problem. Node's documentation has the following statement about adding require paths to NODE_PATH:
You are highly encouraged to place your dependencies locally in node_modules folders. They will be loaded faster, and more reliably.
So basically this means it's considered a bad practice and slows down the app, which I really don't want. Or does this only apply to global paths, so the submodule (which is in the app's root) wouldn't be a problem?