The problem is that it goog.requiredynamically adds the required script tags to the document after the current script tag. So for example:
<script>
goog.require('stuff');
doSomething();
</script>
Translated to:
<script>
goog.require('stuff');
doSomething();
</script>
<script src=[included stuff] type="text/javascript"></script>
The solution must have a separate script tag for requirements:
<script>
goog.require('stuff');
</script>
<script>
doSomething();
</script>
source
share