Quick question, but one I surprisingly couldn’t find the answer for with a bit of Googling… when I use the node interactive interpreter, I can type in the names of basically all core modules and see them output as objects onto the console… however, I understand that the core modules aren’t all included like this by default when running a .js file.
Can anyone clear this up for me? All help appreciated.
Starting in Node 0.8,
repl.jsdefines a list of built-in libraries that will be automatically required when you type their name on the REPL:This is specifically a function of
repl.js, and does not work at all in any way when writing your own Node.js programs; there, you must specificallyrequireanything you want to use.