Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!-- This does nothing -->
<script data-main="path/main.js" />
<!-- Not so good, as it blocks DOM -->
<script type="text/javascript" src="require.js" />
<script type="text/javascript" src="path/main.js" />
<!-- Not so good, as main.js may include require(['foo', 'bar'], function(f, b) {}); which has no meaning outside require.js -->
<!-- (And you can't guarantee main.js won't be executed before require.js) -->
<script type="text/javascript" src="require.js" async defer />
<script type="text/javascript" src="path/main.js" async defer />
<!-- Pretty good, as we can now load javascript with dependencies asynchronously -->
<script type="text/javascript" src="require.js" data-main="path/main" async defer />
<!-- Awesome; Javascript without dependencies. Who cares when it runs -->
<script type="text/javascript" src="module.js" async defer/>
<script type="text/javascript" src="module2.js" async defer />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.