Skip to content

Conversation

@divdavem
Copy link
Member

To unload a module, it should be sufficient to do: delete require.cache[modulePath].

It is not very intuitive to have to do:

var moduleToUnload = require.cache[modulePath];
var parentChildren = moduleToUnload.parent.children;
var index = parentChildren.indexOf(moduleToUnload);
parentChildren.splice(index, 1);
delete require.cache[modulePath];

Moreover, even if node.js provides this feature, it is not very useful to have module.parent and module.children, so let's remove them to avoid any leak problem.

@jakub-g
Copy link

jakub-g commented Jun 26, 2014

63d2439 looks fine for me

@divdavem divdavem merged commit 63d2439 into ariatemplates:master Jun 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants