Is it possible to have multiple require.js projects included in one html file?

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 create the first file and include the js build file in / js / main, but it would be much faster to be able to work on both projects side by side without creating all the time, Right now when I try to do this, mainD4 is building, and then nothing happens with the js / main file.

+6
source share
1 answer

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> 
+6
source

Source: https://habr.com/ru/post/915207/


All Articles