โญES module
ES modues are supported by browsers and servers, with a bit of configuration๏ผ
<!-- โญ๏ธ HTML (browser, client-side JS) -->
<!-- โญโโโโ โญ๏ธ โโโโฎ (module mode) -->
<script type="module" src="script.js"></script>
// โญ๏ธ (Node.js, server-side JS)
// - add this line to "package.json" file
"type": "module",
async scripts
Cross-Origin Scripts
Scripts fetched from another origin (e.g. another site) require CORS headers, as described in the chapter Fetch: Cross-Origin Requests. ๐ JS.info โฉ External scripts
<!-- another-site.com must supply Access-Control-Allow-Origin -->
<!-- otherwise, the script won't execute -->
<script type="module" src="http://another-site.com/their.js"></script>
Last updated
Was this helpful?