Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Missing "main" and "module" entries in "package.json" #1000

Closed
tsmock opened this issue Apr 4, 2023 · 11 comments · Fixed by #1005
Closed

[BUG] Missing "main" and "module" entries in "package.json" #1000

tsmock opened this issue Apr 4, 2023 · 11 comments · Fixed by #1005
Labels

Comments

@tsmock
Copy link

tsmock commented Apr 4, 2023

Describe the bug
Missing "main" and "module" entries in "package.json" causes nodejs (npm/yarnpkg) to not find the correct entries

Version of Package
v5.10.5

Regression from #984 . See https://github.com/ReactTooltip/react-tooltip/pull/984/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L21 .

"main" and "module" are still required for compatibility with other tools, such as nodejs. See https://rollupjs.org/introduction/#publishing-es-modules .

Additional context
I believe you want

  "main": "dist/react-tooltip.min.cjs",
  "module": "dist/react-tooltip.min.mjs",

(the original entries were

  "main": "dist/react-tooltip.cjs.min.js",
  "module": "dist/react-tooltip.esm.min.js",

)

@tsmock tsmock added the Bug label Apr 4, 2023
@tsmock
Copy link
Author

tsmock commented Apr 4, 2023

Also missing:

  • dist/react-tooltip.css
    • dist/react-tooltip.min.css exists .

@gabrieljablonski
Copy link
Member

Thanks for reporting, we'll be updating the package soon with a fix for this.

@gabrieljablonski
Copy link
Member

Please test the official release react-tooltip@5.11.1 and let us know.

@tsmock
Copy link
Author

tsmock commented Apr 10, 2023

I'm getting an error with

Failed to compile.

./node_modules/react-tooltip/dist/react-tooltip.min.mjs
Can't import the named export 'arrow' from non EcmaScript module (only default export is available)

when I run yarnpkg build.

I don't know if it is the new release or me -- I've been working on a project that was using v4.2.21, and updating react-tooltip along with just about every other dependency to something recent.

@gabrieljablonski
Copy link
Member

@tsmock try reinstalling all the dependencies on your project. arrow is imported from @floating-ui/dom internally, so probably something wrong with your project dependencies.

@tsmock
Copy link
Author

tsmock commented Apr 10, 2023

I just tried rm -rf node_modules && yarnpkg install --check-files && yarnpkg build. I'll check and see if reverting to v5.11.0 and using the package.json from v5.11.1 works, just to check.

@gabrieljablonski
Copy link
Member

Whenever you get the time, please open a new issue with a sample project reproducing this problem.

@analuizaalvesm
Copy link

I'm getting an error with

Failed to compile.

./node_modules/react-tooltip/dist/react-tooltip.min.mjs
Can't import the named export 'arrow' from non EcmaScript module (only default export is available)

when I run yarnpkg build.

I don't know if it is the new release or me -- I've been working on a project that was using v4.2.21, and updating react-tooltip along with just about every other dependency to something recent.

I'm facing the same problem, did you manage to solve it?

@gabrieljablonski
Copy link
Member

@analuizaalvesm Could you please open a new issue with a sample project reproducing this problem? It will help us track down what's wrong.

@tsmock
Copy link
Author

tsmock commented May 3, 2023

I've pinned this dependency to 5.10.4. I haven't gotten around to reproducing that error so I can file a separate ticket. The code I was working on doesn't import arrow anywhere, which means that something is trying to import arrow.

The only place in React-Tooltip that imports arrow does so from @floating-ui/dom.

@danielbarion
Copy link
Member

Hey guys, if this is still an issue, please create a new ticket, this will help us to track existing issues and let other people in the community know about the issue.

Thanks for understanding!

@ReactTooltip ReactTooltip locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants