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

About unloading modules #9

Open
anhldbk opened this issue May 5, 2016 · 1 comment
Open

About unloading modules #9

anhldbk opened this issue May 5, 2016 · 1 comment
Labels

Comments

@anhldbk
Copy link

anhldbk commented May 5, 2016

Would you please tell me what will happen with the unloaded module?

In the following image, I expected variable lodash will be undefined or null after the associated module is unloaded. But it's not.

screenshot from 2016-05-05 21-25-32

@osukaa
Copy link
Member

osukaa commented Nov 30, 2017

That won't happen, because you are holding a reference in your lodash variable. .unload('lodash') will remove the module and its dependencies from require.cache. So the next time you do var lodash2 = require('lodash') it will be different from lodash != lodash2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants