Saturday, 8 April 2017

How does require work when calling node module directly?

When calling a node module directly, e.g. $ ./node_modules/.bin/webpack -d, how is the module aware of how to handle any require functions?

I understand how the require function works, but I'm confused where it is defined.

I had assumed that using something like $ npm start would give context to handle require, but how does Node get involved (and define how to handle require) when the module is called directly?



via charliesneath

No comments:

Post a Comment