Using non-AMD compatible javascript module with require.js?

后端 未结 3 913
鱼传尺愫
鱼传尺愫 2020-12-24 14:58

I\'m using require.js to help organize my Backbone.js based application.

I\'m trying to figure out the right way to use a 3rd party javascript library that is not AM

3条回答
  •  情话喂你
    2020-12-24 15:43

    you can wrap your require with another require the plugin will be loaded first, and afterwards you can do your app.

    require(["myCustomTastyPiePlugin.js"], function () {
        //This callback is called after the one script finish loading.
    
        require(["one.js", "two.js", "three.js"], function () {
            //This callback is called after the three scripts finish loading.
    
            // all your code goes here...
    
        });
    });
    

提交回复
热议问题