requireJS with JQuery, Masonry, & ImagesLoaded: Object [object Object] has no method 'imagesLoaded'

前端 未结 5 2203
春和景丽
春和景丽 2021-02-09 16:19

RequireJS newbie here. Trying to convert some JQuery code I had working fine in the old way to work w/ RequireJS.

Header of my page loads three JS files via script tags

5条回答
  •  独厮守ぢ
    2021-02-09 17:12

    Try defining exports for each plugin in the shim too...

    , paths: {
        boot: 'src/boot'
        , jquery: 'bower_components/jquery'
        , masonry: 'bower_components/masonry',
        , imagesloaded: 'bower_components/imagesloaded'
    }
    , shim: {
        jquery: {
            exports: 'jQuery'
        }
        , masonry: {
            deps : ['jquery'],
            exports : 'jQuery.masonry'
        }
        , imagesloaded: {
            deps : ['jquery'],
            exports : 'jQuery.imagesLoaded'
        }
    }
    

提交回复
热议问题