This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
module.parent.filename is cached. #6149
Closed
Description
When a file is called twice, module.parent is cached.
Is this correct behavior?
/home/xxx/yyy/module_parent/
├── a.js
└── up
├── b.js
└── up
└── c.js
a.js
var b, c = require('./up/up/c');
c.dump();
b = require('./up/b')
b.js
var c = require('./up/c');
c.dump();
c.js
exports.dump = function () {
console.log(module.parent.filename);
}
console
/home/xxx/yyy/module_parent/a.js
/home/xxx/yyy/module_parent/a.js
Metadata
Metadata
Assignees
Labels
No labels