Loading mechanism in Node.js modules

// 1.require (path) the require ( './ find.js') 


    // 2 the require (path) path extension omit the require (' ./ Find) 
    // find js file with the same name in the current path to find the same name js folder 
    // if found with the same name folder to find the folder index.js 
    // If there is no index.js will go to the current file package.js file in the file folder to find the entrance of the main options 
    // If the file entry entry file does not exist or is not specified, will be given

 

Guess you like

Origin www.cnblogs.com/treasurea/p/11241285.html