Last updated
Last updated
Require avaliable everywhere
Runs the file
Looks in core modules, then/or all paths specified by module.paths in order which is basically potentially every node_modules folder from curfolder to root
Looks for .js then .json then .node
.js in string is optional
If don't want to just look in node_modules
can use paths
Works whether a config folder with an index.js
or config.js in the current folder
To change main folder, can add package.json to config folder with "main": "start.js"
and it looks at start.js
Recall module is something defined for each file
require returns the module.exports
object
So in config.js
Then in other file
Returns partially loaded module.exports so it can finish
Yes!
process.argv[1] is the filename