Reputation: 15069
I would like to do something like this:
<script data-main="/js/D4/build/mainD4" src="/js/D4/build/require.js"></script>
<script data-main="/js/main" src="/js/require.js"></script>
I could just build the first file, and the include the build js file in /js/main, but it would be much faster to be able to do development on both projects side by side without having to build all of the time. Right now when I try this, mainD4 builds and then nothing happens with the js/main file.
Upvotes: 6
Views: 1157
Reputation: 15069
Just found the answer here: https://groups.google.com/forum/?fromgroups#!topic/requirejs/YWFdgYSU2f4
<script src="scripts/require.js" data-main="scripts/main"></script>
<script>
require(['scripts/another/main']);
</script>
or
<script src="scripts/require.js" data-main="scripts/main"></script>
<script>
(function(){
var req = require.config({baseUrl:'scripts/another'});
req(['main']);
}());
</script>
Upvotes: 6