Yii2 Module & Asset Bundles

I successfully create the module, then the Asset Bundle inside the module for accessing the JS/CSS inside the module.

The issue is that I can not find a way for the Asset Bundle to succesfylly load the JS that I have in the module. I can not find the exact path for it to work.

Anyone already try this successfully ? My issue is not with the asset bundle or the modules, is to get the path for the JS to be load properly.

I hope someone can help me !

I just realized that there was a variable that I was not using " sourcePath ", using that one instead of baseUrl or basePath did the trick.





class RbacAsset extends AssetBundle {


    public $sourcePath = '@backend/modules/admin/assets';

    public $css = [


    ];

    public $js = [

        'js/myJS.js'

    ];

    public $depends = [

        'yii\web\YiiAsset',

        'yii\bootstrap\BootstrapAsset',

    ];

    


}





class RbacAsset extends AssetBundle {


    public $sourcePath = __DIR__;   // see this


    public $css = [


    ];

    public $js = [

        'js/myJS.js'

    ];

    public $depends = [

        'yii\web\YiiAsset',

        'yii\bootstrap\BootstrapAsset',

    ];

    


}