Using AMD modules in Stack Overflow snippets

If you’re answering a question on Stack Overflow and want to use a library in the code snippet that only supports AMD, the following small jig may be useful. Exports are added to the global scope so you can use them directly in the sample code.

<script>
  const define = (_, module) => module();
  define.amd = true;
</script>
<script src="example.com/amd-only.js" crossorigin="anonymous"></script>