Page 93 - Nodejs 교과서 개정2판
P. 93

filename:	'C:\\Users\\zerocho\\var.js',
           				loaded:	true,
           				children:	[],
           				paths:	[
           						'C:\\Users\\zerocho\\node_modules',
           						'C:\\Users\\node_modules',
           						'C:\\node_modules'
           				]
           		}
           }
           require.main입니다.
           true
           C:\\Users\\zerocho\\require.js




         ௑ࣛী աয়ח ҃۽ח ੉ ଼җ ׮ܳ Ѫੑפ׮  ਤ ৘ઁীࢲ ঌইঠ ೡ ੼਷ requireо ߈٘द ౵ੌ ୭࢚ױী ਤ

         ஖ೡ ೙ਃо হҊ  module.exportsب ୭ೞױী ਤ஖ೡ ೙ਃо হ׮ח Ѫੑפ׮  ইޖ Ҕীࢲա ࢎਊ೧ب ؾפ׮


         require.cache ё୓ী SFRVJSF KTա WBS KT э਷ ౵ੌ ੉ܴ੉ ࣘࢿݺਵ۽ ٜয ੓ח Ѫਸ ࠅ ࣻ ੓णפ׮  ࣘࢿ

         чਵ۽ח п ౵ੌ੄ ݽٕ ё୓о ٜয ੓णפ׮  ೠ ߣ requireೠ ౵ੌ਷ require.cacheী ੷੢غ޲۽ ׮਺ ߣ

         ী requireೡ ٸח ࢜۽ ࠛ۞য়૑ ঋҊ require.cacheী ੓ח Ѫ੉ ੤ࢎਊؾפ׮

         ݅ড ࢜۽ requireೞӡ ਗೠ׮ݶ  require.cache੄ ࣘࢿਸ ઁѢೞݶ ؾפ׮  ׮݅  ೐۽Ӓ۔੄ ز੘੉ Ԙੌ ࣻ

         ੓ਵ޲۽ ӂ੢ೞ૑ח ঋणפ׮  ࣘࢿਸ ੗ࣁ൤ ࢓ಝࠁݶ  module.exports೮؍ ࠗ࠙ exports ੉ա ۽٬ ৈࠗ lo
         aded   ࠗݽ parent   ੗ध children  ݽٕ ҙ҅ܳ ଺ਸ ࣻ ੓णפ׮


         require.main਷ ֢٘ प೯ द ୐ ݽٕਸ оܻఈפ׮  അ੤ node	require۽ प೯೮ਵ޲۽ require.jsо requi
         re.main੉ ؾפ׮  require.main ё୓੄ ݽন਷ require.cache੄ ݽٕ ё୓৬ эणפ׮  അ੤ ౵ੌ੉ ୐ ݽٕ

         ੋ૑ ঌইࠁ۰ݶ require.main	===	moduleਸ ೧ࠁݶ ؾפ׮  node	require۽ प೯ೠ ҃਋  var.jsীࢲ requi
         re.main	===	moduleਸ प೯ೞݶ falseо ߈ജؼ Ѫੑפ׮  ୐ ݽٕ੄ ੉ܴਸ ঌইࠁ۰ݶ require.main.filen

         ameਵ۽ ഛੋೞݶ ؾפ׮


         ݽٕਸ ࢎਊೡ ٸ ઱੄೧ঠ ೡ ੼੉ ੓णפ׮  ݅ড ف ݽٕ EFQ җ EFQ о ੓Ҋ ੉ ل੉ ࢲ۽ܳ requireೠ׮
         ݶ যڌѱ ؼөਃ

          dep1.js

           const	dep2	=	require('./dep2');
           console.log('require	dep2',	dep2);
           module.exports	=	()	=>	{
           		console.log('dep2',	dep2);
           };
   88   89   90   91   92   93   94   95   96   97   98