Require.js lazy loading remote url
问题 I have a file called moment.js on my local file system and loading it as follows with require.js works: initialize: function() { require(['moment'], function(data) { console.log(data); }); } However, if I do: initialize: function() { require(['http://momentjs.com/downloads/moment.min.js'], function(data) { console.log(data); }); } data comes back undefined. Why is this? and how do I dynamically include remote modules at runtime? 回答1: I noticed that the code you are trying to load hardcodes