Order of asset bundles

Hello everyone.

I have AppAsset with my custom my.js file.
public $js = ['bundle/my.js'];

Switch off jQuery:
'assetManager' => [ 'bundles' => [ 'yii\web\JqueryAsset' => false, ] ],

And use ActiveForm Extension.

After render i have such an order of JS files (my js at the last place):

script src=“assets/4af512e/yii.js”
script src=“assets/4af512eyii.validation.js”
script src=“assets/4af512e/yii.activeForm.js”
script src=“bundle/my.js”

But i really need my file to be the first.

I did’t find any info about this in docs.

Yes i know, that i can override jquery dependency in assetManager config section and put my file in $js variable instead of jquery.js but i want to do this in my AppAsset.

Hope for your help :slight_smile:


I don’t think it’s doable via your own asset. You’ll need to change the config and make the jquery bundle depends on your asset. Any reason why this isn’t a valid solution for you ?