kenchris / urlpattern-polyfill

URLPattern polyfill
https://www.npmjs.com/package/urlpattern-polyfill
MIT License
267 stars 30 forks source link

Invalid `main` in package.json #38

Closed zachleat closed 2 years ago

zachleat commented 3 years ago
Error: Cannot find module '/Users/zachleat/Code/eleventy/node_modules/urlpattern-polyfill/dist/index.cjs'. Please verify that the package.json has a valid "main" entry

I don’t see an index.cjs in the dist folder locally on rc1—did I miss something?

jeffposnick commented 3 years ago

I think that the reference to a .cjs file comes from the instructions at https://github.com/developit/microbundle#-installation--setup--, but that info is out of date.

The main field should probably be set to the .umd.js file, as shown in the example a little bit further down the page.

Paso commented 2 years ago

A quick work around is to import the specific file manually.

eg. import { URLPattern } from 'urlpattern-polyfill/dist/index.umd';