Node module require deep understand it

require.resolve(‘myModel’): this behaves exactly the same as require, but does not load the file. It will still throw an error if the file does not exist. This can be use for check an package is installed or not.



  1. try something.js
  2. try something.json
  3. try something.node