Calling require on ModuleScripts while in edit mode should not cache and run the module again

At the moment, while in Edit Mode, requiring a module script via the command bar, or a plugin like InCommand, will behave similarly to how it does at the actual runtime. It will cache the result, and never run the module again.

This makes sense when the game is actually running, but in edit mode, where you might have a workflow that involves running your scripts via plugins for the ease of it and avoiding play testing, this is disadvantageous, as you can’t edit module scripts and run them again.

If while in edit mode, module scripts were not cached and ran every time you required them, that’d make more sense and will be more helpful, assuming it will not interfere with the activites of plugins.

4 Likes

They have the debug.loadmodule function but they haven’t enabled yet for some reason, but yeah, I have come across this issue many times.

1 Like

Support, insanely annoying behavior.

A workaround for this in the meantime is requiring a cloned version of the module; eg. require(module:Clone())

2 Likes

I suggest instead enabling debug.loadmodule in Studio.

Modules caching is a feature of vanilla Lua, and even besides that, Roblox likes parity between Studio and RCC (loadmodule wouldn’t be parity of course lol, though it could just have the same restriction as require on RCC when it comes to compilation)

2 Likes

This isn’t doable automatically with plugins because you would break a lot of existing plugins. For example, anyone using Roact would find that suddenly all symbols for things like Roact.None etc are different every require. The ability to load individual module scripts without the cache (such as debug.loadmodule) would be a better solution for this, but that would be a separate feature request (of which I think we have a few?).

However, I think this is reasonable for command bar, it’s already kind of a separate environment to the extent where I doubt there’s any workflows this would break.

2 Likes

I actually did request this a while ago but it feels like it fell on deaf ears

3 Likes

There’s some internal issues that are stopping this right now, and I cannot promise anything, just that it’s what would solve this problem better than automatically doing it for plugins.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.