What will and will not work depends on how the file that defines several named modules will be used in the application.
In general, if the order in which the modules defined (using named defines) in a single file cannot be determined, then setting paths to match the module names to the specified file should prevent problems:
paths: { 'foo': 'path/to/foobar', 'bar': 'path/to/foobar' }
If foo or bar required, RequireJS will load a file that defines both ( path/to/foobar.js ), which is not a problem.
With the details that you added to the question, I can say this. Firstly, this code:
<script src="scripts/require.js" data-main="app/main.js"></script> <script src="scripts/datajs-1.1.2.js"></script>
wrong. Loading a module that calls define via the <script> tag is usually incorrect. (I would say that this is always wrong, but there may be some really strange cases when you need incompatible assets to work together, you should do something that would normally be wrong. But this is unusual and should be justified.) How when you offer to do this, you open yourself to the questions of time. Sometimes it may work, sometimes it may not.
However, this should prevent any time issues:
<script> require = { paths: { datajs: 'scripts/datajs-1.1.2', OData: 'scripts/datajs-1.1.2' } }; </script> <script src="scripts/require.js" data-main="app/main.js"></script>
Whenever either of the two modules in datajs-1.1.2.js , either because it is called require , or because it is called define with the appropriate module names, a file that defines both modules will be loaded.
(Warning: the configuration shown in the example above is an educated guess that contains enough details to illustrate. It may not work in conjunction with the configuration already present in app/main.js , and I don't assume that it this is the best way to configure RequireJS for your specific application.)
For RequireJS version 2.1.10 and higher, there is also a bundles option, which is more convenient to use:
<script> require = { bundles: { "js/datajs-1.1.2": ["datajs", "OData"] } }; </script> <script src="scripts/require.js" data-main="app/main.js"></script>
I suggest reading the documentation for this parameter to avoid possible misunderstandings about how this works.