Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module.children doesn't contain cached modules #7131

Closed
tamtakoe opened this issue Jun 3, 2016 · 3 comments
Closed

module.children doesn't contain cached modules #7131

tamtakoe opened this issue Jun 3, 2016 · 3 comments
Labels
module Issues and PRs related to the module subsystem.

Comments

@tamtakoe
Copy link

tamtakoe commented Jun 3, 2016

  • Version: v4.4.0, v7.0.0-pre (I think any node version)
  • Platform: Ubuntu 15.10
  • Subsystem: module

main.js

require('./b');
require('./a');
require('./c');

a.js

require('./b');
require('./c');

console.log(module.children);

b.js, c.js

//some code

If we run main.js we have children array only with c.js because b.js was cached

[<Module c.js>]
@vkurchatkin vkurchatkin added the module Issues and PRs related to the module subsystem. label Jun 3, 2016
@vkurchatkin
Copy link
Contributor

#3933

@Trott
Copy link
Member

Trott commented Jul 7, 2017

I guess the question is: Is this a code bug or a documentation issue? I suspect the latter. Not sure who to ping for an opinion. Let's try @nodejs/ctc

@bnoordhuis
Copy link
Member

I'd say it's a bug. I have a potential fix in #14132.

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jul 24, 2017
`module.children` is supposed to be the list of modules included by this
module but lib/module.js failed to update the list when the included
module was retrieved from `Module._cache`.

Fixes: nodejs#7131
PR-URL: nodejs#14132
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
addaleax pushed a commit that referenced this issue Jul 24, 2017
`module.children` is supposed to be the list of modules included by this
module but lib/module.js failed to update the list when the included
module was retrieved from `Module._cache`.

Fixes: #7131
PR-URL: #14132
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Issues and PRs related to the module subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants