How to make core scripts loading such as jQuery in Yii2?

How to make core scripts loading such as jQuery in Yii2?
a
admin 03 May, 2020 - فى Yii2
606

By using the Yii2 framework, you expect to load the default assets especially the JQuery and Bootstrap javascript files, but it doesn't not.

What is wrong?

If you opened the AppAsset.php file which is present by default in the Yii2 framework, it seems the following

class AppAsset extends AssetBundle

{

public$basePath = '@webroot';

public$baseUrl = '@web';

public$css = [

'css/site.css',

];

public $js = [];

public $depends = [

'yii\web\YiiAsset',

'yii\bootstrap\BootstrapAsset',

];

}

 

By checking the last line in $depends you will find asking the Yii2 framework to load the bootstrap incompletely and we need to replace this line to solve the problem by the following line

'yii\bootstrap\BootstrapPluginAsset',