My project includes the following files:
./index.html
./js/main.js
./js/vendor/require.js
./js/viewmodel/vm.js
The index.html
That's because requirejs sets the async. Attribute on the script.
The boolean async attribute on script elements allows the external JavaScript file to run when it's available, without delaying page load first.
This means that both scripts are loaded and evaluated parallel, so none of the two scripts can access methods or functions from the other one. If you want to define requirejs variables in one script you mustn't load that script with require js.
For me there are three possibilities how you can solve that problem: