Search code examples
moduleyii2assetsvendorassetbundle

Yii2 disable asset of a vendor module


I have installed yii2-admin module, located in /vendor/mdmsoft/yii2-admin but I don't want it to load its own asset bundle. It there any way to disable this module asset bundle?


Solution

  • Yes, it's possible and even mentioned in official docs here. One way to do it is through application config:

    return [
        // ...
        'components' => [
            'assetManager' => [
                'bundles' => [
                    'mdm\admin\AdminAsset' => false,
                ],
            ],
        ],
    ];
    

    Another way - during runtime through component:

    \Yii::$app->assetManager->bundles['mdm\admin\AdminAsset'] = false;