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

Unload or ability to redefine a module? #9

Open
joewood opened this issue Jun 20, 2017 · 3 comments
Open

Unload or ability to redefine a module? #9

joewood opened this issue Jun 20, 2017 · 3 comments

Comments

@joewood
Copy link

joewood commented Jun 20, 2017

It would be useful to redefine a module using define or provide a function to unload a module. Right now calling define with the same module name (with ignore duplicates) ignores the contents if it has changed.

@joewood
Copy link
Author

joewood commented Jun 20, 2017

Another solution to being able to redefine a module would be to use a local AMDLoader ModuleManager. Right now the loader is defined to be global (AMDLoader is defined in global scope and not inside a function enclosure). Adding a parent function enclosure to optionally define a separate local AMDLoader, with its own ModuleManager would make it easier to tear down and redefine modules.

@alexdima
Copy link
Member

alexdima commented Mar 2, 2018

Today, it is possible to reset the state via require.reset(), but I like the idea of being able to overwrite a specific module if necessary, without resetting everything...

@SamB
Copy link
Contributor

SamB commented Aug 6, 2019

Is this about reloading modules to try out changes during development (which is a thing that people are going to sometimes want with more-or-less any module loader, whether that's practical or not), or for some kind of mocking/shimming/SxS type thing?

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

No branches or pull requests

3 participants