Page 94 - Nodejs 교과서 개정2판
P. 94
dep2.js
const dep1 = require('./dep1');
console.log('require dep1', dep1);
module.exports = () => {
console.log('dep1', dep1);
};
EFQ SVO KTܳ ٜ݅য ف ݽٕਸ प೯೧ࠁѷणפ
dep-run.js
const dep1 = require('./dep1');
const dep2 = require('./dep2');
dep1();
dep2();
٘о ਤীࢲࠗఠ प೯غ۽ require('./dep1') ݢ प೯ؾפ dep1.jsীࢲח ઁੌ ݢ require('./
dep2')о प೯غחؘਃ द dep2.jsীࢲח require('./dep1') प೯ؾפ җ ҅ࣘ ߈ࠂغ۽ য
ڌѱ ؼ ҾӘೡ ѩפ पઁ۽ प೯೧ࠇद
콘솔
$ node dep-run
require dep1 {}
require dep2 [Function (anonymous)]
dep2 [Function (anonymous)]
dep1 {}
(node:29044) Warning: Accessing non-existent property 'Symbol(nodejs.util.inspect.custom)' of module export
s inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created)
...
֥ۉѱب EFQ module.exportsо ೣࣻо ইפۄ ࠼ ё۽ दؾפ ۞ೠ അ࢚ਸ ࣽജ ଵઑ DJSDVMBS EF
QFOEFODZ ۄҊ ࠗܵפ ۧѱ ࣽജ ଵઑо ਸ ҃ীח ࣽജ ଵઑغח ࢚ਸ ࠼ ё۽ ٟ݅פ ٸ ী
۞о ߊࢤೞ ঋҊ ઑਊ ࠼ ё۽ ߸҃غ۽ ӝ ޅೠ ز ߊࢤೡ ࣻ णפ ٮۄࢲ ࣽജ ଵઑо
ߊࢤೞ ঋب۾ ҳઑܳ ੜ ח Ѫ ਃפ
QSPDFTT
process ёח അ प೯غҊ ח ֢٘ ۽ࣁझী ೠ ࠁܳ Ҋ णפ process ё উীח নೠ
ࣘࢿ חؘ ೞաঀ 3&1-ী ٮۄ ੑ۱೧ࠇद ѾҞч ࢎਊ ஹೊఠ݃ ରо ਸ ࣻ ਵ۽
଼ чҗ ܰ؊ۄب ѣೞ ݃ࣁਃ