2

I create module to show instagram photos here my view->frontend :

frontend--/
    |layout--/
    |     cms_index_index.xml
    |     default.xml
    |
    |templates--/
    |     instafeed.phtml
    |
    |web--/
    |     js--/
    |        instafeed.min.js
    |        main.js 
    |
    |requirejs-config.js

requirejs-config.js

var config = {
"paths":
{
    "insta": "Test_Instafeed/js/instafeed.min",
    "instaMain": "Test_Instafeed/js/main",
}};

main.js

    require(["insta"], function(){
        (function ($)
        {
             var feed = new Instafeed({
                get: 'tagged',
                tagName:  'awesome',
                clientId: 'xxxxxxxxxxxxxxx',
                resolution: 'low_resolution',
                limit: '32',
              });
        });
   });
   feed.run();

instafeed.phtml

<h1><?php echo $block->getTitle(); ?></h1>
<hr />
<div id="instafeed"></div>

But I always get error :

Uncaught Error: Mismatched anonymous define() module: function (){return e}
http://requirejs.org/docs/errors.html#mismatch

Uncaught Error: Mismatched anonymous define() module: function ()
{
    feed.run();
}

I'm getting confuse with this, if anybody can help me, I will appreciate :)

1

Check your folder structure: The requirejs-config.js should be placed in the web folder, not in the frontend folder.

|web--/
|     js--/
|        instafeed.min.js
|        main.js 
|     requirejs-config.js
|improve this answer|||||
  • 1
    I put requirejs-config.js inside web folder, but I still get error : Uncaught Error: Mismatched anonymous define() module: function (){return e} requirejs.org/docs/errors.html#mismatch . By the way the second error is missing. – dira Mar 21 '16 at 1:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.