nWidart / laravel-modules

Module Management In Laravel
https://docs.laravelmodules.com
MIT License
5.56k stars 969 forks source link

module.json won't load files anymore #1942

Closed lazosweb closed 2 months ago

lazosweb commented 2 months ago

Versions:

Description:

In my modules I used to load the helpers using the files array inside the module.json.

With the update to 11.1.0, that broke and it does not load my helpers.php and I had to move them into the module's composer.json or go back to 11.0.11.

{
    "name": "Core",
    "alias": "core",
    "description": "",
    "keywords": [],
    "active": 1,
    "priority": 0,
    "providers": [
        "Modules\\Core\\Providers\\CoreServiceProvider",
        "Modules\\Core\\Providers\\AjaxRoutesServiceProvider",
        "Modules\\Core\\Providers\\MacroServiceProvider"
    ],
    "aliases": {},
    "files": [
        "Helpers/helpers.php"
    ],
    "requires": []
}

After further investigation... On the latest release $this->app->register(\Nwidart\Modules\Providers\BootstrapServiceProvider::class); is commented out and will not register the files.

/**
     * Register all modules.
     */
    protected function registerModules()
    {
        // $this->app->register(\Nwidart\Modules\Providers\BootstrapServiceProvider::class);

        $providers = app()->make(ModuleManifest::class)->providersArray();

        (new ProviderRepository($this->app, new Filesystem(), $this->getCachedModulePath()))
            ->load($providers);

    }
takashato commented 2 months ago

I just found the new one "ModuleManifest", which still read from the module.json, but only the priority and providers are taken into account, so the files aren't loaded. Probably need the implementation for that. And this causes the BootstrapServiceProvider redundant.

dcblogdev commented 2 months ago

thanks, yes looks like you're right. I'll look at getting files supported.