ungap / custom-elements

All inclusive customElements polyfill for every browser
ISC License
240 stars 14 forks source link

ES module tips #16

Closed J-env closed 1 year ago

J-env commented 1 year ago

@ungap/custom-elements doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

image
WebReflection commented 1 year ago

it's a polyfill ... it doesn't matter at all what kind of CommonJS or ESM module it is, you import or require it without needing to assign it to anything, as it doesn't export anything at all.

// you're done in ESM
import '@ungap/custom-elements';

// you're done in CommonJS
require('@ungap/custom-elements');

please file a bug in Astro as there's nothing I need to do here, 'cause that's how side-effecting on the global polyfills work, thanks.