3 ms·
Can you use <script type="module"> with web components/Polymer (in a sane way, e.g. without duplicates being loaded like with the old <script> tag)?
by nawitus 11y ago
Can you use <script type="module"> with web components/Polymer (in a sane way, e.g. without duplicates being loaded like with the old <script> tag)?
- spankalee 11y agoYou will be able to (somewhat) soon! Support is going to roll out in 3 steps: 1. A system that converts <script type=module> to HTML imports so that loading and ordering is consistent across JS and HTML imports. The converter will run in `polytool build` (polytool is the Polymer CLI in development) and in `polytool serve` (the dev server). 2a. Chrome's implementation of <script type=module> will work correctly with HTML imports, so that HTML imports wait on any JS modules and their transitive dependencies before signaling ready. 2b. The HTML imports polyfill will wait for JS modules to load (this might require no work). 3. HTML imports itself is being re-imagined as a layer on top of the JS module loader, so that HTML is just a different file type that can be loaded and participate in the dependency graph. This idea of "HTML Modules" has positive feedback from other browser vendors so far.
- thegayngler 11y agoThanks! Where can I read more about this?
- deleted 11y ago[deleted]
- domenicd 11y agoDeduplication/memoization is built in to the spec, if that helps: https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script https://html.spec.whatwg.org/multipage/webappapis.html#fetch... steps 2 and 3.