kenchris / urlpattern-polyfill

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

Missing `main` field from package.json causes problem with eslint `node/no-missing-require` #75

Closed lachlanhunt closed 2 years ago

lachlanhunt commented 2 years ago

After the recent change intended to support CommonJS, the ability to require("urlpattern-polyfill") now works, but due to the missing main field in package.json pointing to the CJS version, the eslint rule node/no-missing-require now complains about the line to require("urlpattern-polyfill");.

To fix this, add these lines back to package.json

  "main": "./dist/index.cjs",
  "module": "./dist/index.js",

I've tested this fix when using CommonJS. I haven't yet tested the fix when using ESM.

SanderElias commented 2 years ago

This is probably resolved by the 4.0.0 version. Can you confirm?

SanderElias commented 2 years ago

@lachlanhunt We learned a couple of things today about package.json. Check 4.0.1, which will be out shortly.

lachlanhunt commented 2 years ago

4.0.1 works, thanks.