cancel
Showing results for 
Search instead for 
Did you mean: 

Require JS shim and third party script

Require JS shim and third party script

I'm trying to include blockUI javascript in my extension, and I added this code

var config = {
  paths:{
        "blockUI":"Mypackage_Mymodule/js/jquery.blockUI.js"
    },
    shim:{
        'blockUI':{
            'deps':['jquery']
        }
    }
};

But keep getting this error:
Error: Script error for: blockUI http://requirejs.org/docs/errors.html#scripterror

 

Not sure what I'm doing wrong here

2 REPLIES 2

Re: Require JS shim and third party script

 

var config = {
  paths:{
        "blockUI":"Mypackage_Mymodule/js/jquery.blockUI"
    },
    shim:{
        'blockUI':{
            'deps':['jquery']
        }
    }
};

You have to remove .js file extension from js declaration. 

You have to replace Mypackage_Mymodule/js/jquery.blockUI.js  with Mypackage_Mymodule/js/jquery.blockUI in above path declaration in requirejs-config.js file.

 

Thanks.

 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Require JS shim and third party script

@jstrez77 Please let me know if you have issue regarding requirejs file.

 

Thanks.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial