Yes, as long as they’re just loaders, and not what I like to call module providers. Here’s what I mean:
Providers: Require modules, which you get in your scripts using something like: local ServiceModule = Framework:Get("ServiceModule")
or local ServiceModule = Framework.Services.ServiceModule
Loaders only: Require modules only to run startup steps (like an Init/Setup/Start sequence), and that’s it. Modules get other modules by regular requires: local ServiceModule = require(ReplicatedStorage.Services.ServiceModule)
Because of the way most providers load modules (GetChildren, require, put in table), intellisense is completely lost. If you want intellisense while keeping a sort of “provider” format, the only ways around it that i’m aware of are:
make types for every single module and make sure to provide said type whenever that module is required somewhere else. This imo is very tedious, having to keep a separate module up to date, especially in a large codebase…
require the modules directly in a table, then reference said table directly as well:
-- Framework module (your module loader)
local Framework = {}
local services = {
ServiceModule = require(folder.ServiceModule),
}
-- do some stuff like run Init/Setup/Start, setup signals, etc
Framework.Services = services
return Framework
-- in some other script:
local Framework = require(path.to.Framework)
local ServiceModule = Framework.Services.ServiceModule
This does make you require only the framework to get the services you need, and keep intellisense, however you’re gonna need to make sure your list of required modules are always up to date.
When you step back and think about it, really the advantage of module loaders (Single Script Architecture) is being able to require the modules in advance so that other places that need it won’t have to go through yielding/init/setup etc steps. Providing the modules afterwards is just a convenience, and if you have plugins for autocomplete like Require Autocomplete, it’s really not necessary – not to mention, losing intellisense, which you have to work around and deal with.