Skip to content

Instantly share code, notes, and snippets.

@sandipchitale
Last active May 14, 2021 04:17
Show Gist options
  • Save sandipchitale/1e2eccb84a1fc6c630dcb260dfe648e9 to your computer and use it in GitHub Desktop.
Save sandipchitale/1e2eccb84a1fc6c630dcb260dfe648e9 to your computer and use it in GitHub Desktop.
Load modules with script type=module tag #javascript #module
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" type="image/x-icon">
<title>Module</title>
</head>
<body>
<script type="module">
import * as $ from 'https://code.jquery.com/jquery-3.6.0.slim.js'
</script>
<!-- <script type="text/javascript" src="js/jquery.min.js" onload="window.$ = window.jQuery = module.exports;"></script> -->
<script type="text/javascript">
window.onload = function()
{
if (window.jQuery)
{
alert('jQuery is loaded');
}
else
{
alert('jQuery is not loaded');
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment