Skip to content

What is the appropriate way to import & setup react-tooltip as of 5.10.5? #1002

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

Closed
tliu30 opened this issue Apr 5, 2023 · 5 comments · Fixed by #1005
Closed

What is the appropriate way to import & setup react-tooltip as of 5.10.5? #1002

tliu30 opened this issue Apr 5, 2023 · 5 comments · Fixed by #1005

Comments

@tliu30
Copy link

tliu30 commented Apr 5, 2023

Hi react-tooltip devs!

I was attempting to upgrade from 5.10.0 to 5.10.5, and noticed what seem to be some changes in the build. I wasn't sure if these changes were expected (the README doesn't seem to have changed), so wanted to ask you directly.

Here's what I see on my local machine after using npm to install version 5.10.5:

➜  ls -l node_modules/react-tooltip/dist/
-rw-r--r--    201 Apr  5 11:38 react-tooltip-tokens.css
-rw-r--r--  36970 Apr  5 11:38 react-tooltip.cjs
-rw-r--r--  64070 Apr  5 11:38 react-tooltip.cjs.map
-rw-r--r--   4334 Apr  5 11:38 react-tooltip.d.ts
-rw-r--r--  12355 Apr  5 11:38 react-tooltip.min.cjs
-rw-r--r--  51359 Apr  5 11:38 react-tooltip.min.cjs.map
-rw-r--r--   1295 Apr  5 11:38 react-tooltip.min.css
-rw-r--r--  11787 Apr  5 11:38 react-tooltip.min.mjs
-rw-r--r--  51067 Apr  5 11:38 react-tooltip.min.mjs.map
-rw-r--r--  36173 Apr  5 11:38 react-tooltip.mjs
-rw-r--r--  63803 Apr  5 11:38 react-tooltip.mjs.map
-rw-r--r--  40803 Apr  5 11:38 react-tooltip.umd.js
-rw-r--r--  64168 Apr  5 11:38 react-tooltip.umd.js.map
-rw-r--r--  12596 Apr  5 11:38 react-tooltip.umd.min.js
-rw-r--r--  51379 Apr  5 11:38 react-tooltip.umd.min.js.map

First, there is no longer a non-minified CSS file, i.e., there is no longer a react-tooltip.css. Was that intentional? I'm noticing that the README still refers to the non-minified file; the README also states that are minified and non-minified versions of each module.

Second, trying to import directly as react-tooltip doesn't seem to work anymore - i think possibly because instead of having esm and cjs modes, there's now just a *.cjs or *.mjs. What's the correct way to import those files? By specifying, e.g., import XXX from @react-tooltip.mjs?

Thanks again!
tliu30

@tliu30 tliu30 added the Question label Apr 5, 2023
@danielbarion
Copy link
Member

danielbarion commented Apr 5, 2023

Hi @tliu30, thanks for reporting, we are trying to decrease the bundle size removing the unnecessary things, but we are not removing those files.

We'll take a look as soon as we have time this week at this issue.

Thank you so much!

@danielbarion
Copy link
Member

Hi, can you test this beta release and let us know, please?

Beta version:

or

@targumon
Copy link

targumon commented Apr 10, 2023

Not 100% sure, but it's probably related:
Starting with 5.10.5 (I also checked 5.10.6 that was released just an hour ago...) eslint chokes on the import {Tooltip} from 'react-tooltip' line and gives an error Unable to resolve path to module 'react-tooltip' import/no-unresolved

I can add // eslint-disable-next-line import/no-unresolved just before the import line to silence it, but for now I just downgraded to 5.10.4.

EDIT: test / watch / build - all work fine. it's just the lint step that fails.

@gabrieljablonski
Copy link
Member

Please test the official release [email protected] and let us know.

@targumon
Copy link

Works for me - thank you for the hard work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants