node project npm third-party packages quoting rules

// In node project we would normally use to a third party dependencies, such as the following code 
var
Template = the require ( 'Template-Art')

How the program is loaded into the third-party file package it?

  1. Locate the directory node_module in the root directory of the current project
  2. Found art-template directory in the directory node_module
  3. Find package.json file in the ar-template directory
  4. Read the main file attributes package.json
  5. mian execution entry records the file attribute of the current packet
  6. The file entry is then loaded, it is loaded to the art-template dependent package
  7. If you do not package.json file, or no main attribute, it will default load index.js
  8. If it does not index.js, will be the parent directory to the root directory of the current project to find, knowing disk root directory
  9. If not, it will error

 

Guess you like

Origin www.cnblogs.com/recode-hyh/p/12655908.html