0

i have a problem with requirejs. I want to render a map on, for example catalog_product_view.xml using THIS. So i have to include https://sandbox-geowidget.easypack24.net/js/sdk-for-javascript.js on product page. I did everything from THIS and it works, i am getting alert(). But when i try to add above script, i am getting an error from the title. I did:
myfile.js:

define(['jquery', 'https://sandbox-geowidget.easypack24.net/js/sdk-for-javascript.js'], function($){
   "use strict";
       return function myscript()
       {
           alert('hello myscript');
           //put all your myfile js code here
       window.easyPackAsyncInit = function () {
        easyPack.init({});
        var map = easyPack.mapWidget('easypack-map', function(point){
            console.log(point);
        });
    };

       }
});   

I also tried this:
myfile.js:

define(['jquery'], function($){
   "use strict";
       return function myscript()
       {
           alert('hello myscript');
           //put all your myfile js code here
window.easyPackAsyncInit = function () {
        easyPack.init({});
        var map = easyPack.mapWidget('easypack-map', function(point){
            console.log(point);
        });
    };
       }
});   

my.phtml:

<script type="text/javascript">
    require(['myscript','jquery', 'https://sandbox-geowidget.easypack24.net/js/sdk-for-javascript.js'], function(myscript, $, test) {
        myscript();
    });
</script>   

In both cases i am gettig Mismatched error. Script is included, because map starts to load. But then i get this error and i can wait till infinity, but all i get is loader. Do you have any idea how can i handle this issue? Thanks in advance :)

  • are you using this in module or Theam ? – Msquare Apr 2 at 11:03
  • @Msquare In custom shipping module. I have to render this map on chcekout. But when i try to load it on site like product page it also does not work – SebastianT Apr 2 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.