nygardk / react-share

Social media share buttons and share counts for React
MIT License
2.6k stars 429 forks source link

Missing `index.umd.cjs` in final build #515

Closed kilemensi closed 7 months ago

kilemensi commented 7 months ago

Description

The exports.require in package.json points to index.umd.cjs. Shouldn't it point to index.cjs instead?

Otherwise, getting this error on require.resolve("react-share")

Error: Cannot find module '/Users/xxx/node_modules/react-share/dist/index.umd.cjs'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1098:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1091:15)
    at resolveExports (node:internal/modules/cjs/loader:567:14)
    at Module._findPath (node:internal/modules/cjs/loader:636:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/Users/xxx/jest.config.js:9:20)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
 ELIFECYCLE  Command failed with exit code 1.

Versions

react-share: 5.0.2 node: 18.18.2

nygardk commented 7 months ago

Hey and thanks for pointing this out! Indeed it should. I don't know where this .umd. had slipped in from 👀 .

Fixed now in v5.0.3!

kilemensi commented 7 months ago

Thanks for the speed response @nygardk. Tested v5.0.3 and it fixes this issue.