Is 'dot slash' (./) mandatory when a module in Node.js is required? -


i'm learning node.js , writing simple module using visual studio 2015 node.js extension.

i know ./ means 'look file in same directory'. in systems i've seen (say, #include in c++) forwarding ./ optional. i've tried remove turns out node.js cannot find modules without prefix. me seems ugly, mandatory? if yes, why?

regards,

with require('./script_name'), can include js within same folder, know already.

when require('module_name') without ./, node.js looks @ node_modules folder module name. optionally, can call it's public methods or pass arguments.


Comments