How to force jQuery UI asset always included before Bootstrap plugin asset in Yii2?

I have a problem that appears from including BootstrapPluginAsset before JuiAsset. (Link: Uncaught Error: cannot call methods on button prior to initialization; attempted to call method ‘loading’).

Since the \yii\web\BootstrapPluginAsset only have dependency to yii\web\JqueryAsset and yii\bootstrap\BootstrapAsset not \yii\jui\JuiAsset (link), how to make sure that \yii\jui\JuiAsset will always be included before yii\bootstrap\BootstrapAsset?

In AppAsset.php add $depends array,




public $depends = [

    'yii\web\YiiAsset',

    'yii\bootstrap\BootstrapAsset',

    'yii\bootstrap\BootstrapPluginAsset',

];



Asset Dependencies