admin管理员组

文章数量:1399912

The current Lit element starter projects rollup builds publish the bundles in esm format.

I'd like to switch out the rollup build with Vite, and the Vite Library builds output UMD format.

Can we switch out esm format with UMD format?

Is there anything that esm does that we cannot do with UMD?

For example with the current Lit builds we can use a component published to NPM like this via the UNPKG CDN.

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

Can we do the same thing with UMD?

Are there any differences as far as regular imports go. For example with esm we can do import { ExampleComponent } from "example-component". Is it the same with UMD?

本文标签: javascriptIs the UMD format interchangeable with ESM for Web Components served over CDNsStack Overflow