Skip to content

Instantly share code, notes, and snippets.

@xgqfrms
Last active October 16, 2023 05:55
Show Gist options
  • Save xgqfrms/1e3f49e27b36509ae814eccf8e52c6d4 to your computer and use it in GitHub Desktop.
Save xgqfrms/1e3f49e27b36509ae814eccf8e52c6d4 to your computer and use it in GitHub Desktop.
script type="module" All In One

script type="module" All In One

<script type="module"></script>

<script type="module" src="main.js"></script>
<script type="module">
  /* JavaScript module code here */
</script>
<script type="importmap">
  {
    "imports": {
      "shapes": "./shapes/square.js",
      "shapes/square": "./modules/shapes/square.js",
      "https://example.com/shapes/square.js": "./shapes/square.js",
      "https://example.com/shapes/": "/shapes/square/",
      "../shapes/square": "./shapes/square.js"
    }
  }
</script>

refs

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html

https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/modulepreload

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import

https://javascript.info/modules-intro

@xgqfrms
Copy link
Author

xgqfrms commented Nov 29, 2021

<!-- CDN -->
<script async type="module" src="https://unpkg.com/emoji-elements/src/index.js"></script>

<!-- npm -->
<script async type="module" src="/node_modules/emoji-elements/src/index.js"></script>

<!-- ES Module -->
<script type="module">
  import '/node_modules/emoji-elements/src/index.js';
  // ...
</script>

https://www.webcomponents.org/element/emoji-element

@xgqfrms
Copy link
Author

xgqfrms commented Nov 29, 2021

script & type="text/typescript" All In One

作者:xgqfrms
链接:https://www.cnblogs.com/xgqfrms/p/14961569.html
来源:https://www.cnblogs.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
©xgqfrms 2012-2021
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️

https://www.cnblogs.com/xgqfrms/tag/script%20type/

@xgqfrms
Copy link
Author

xgqfrms commented Oct 16, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment