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

ESLint warning: Package subpath './dist/react-tooltip' is not defined #987

Closed
binomialstew opened this issue Mar 21, 2023 · 17 comments · Fixed by #1005
Closed

ESLint warning: Package subpath './dist/react-tooltip' is not defined #987

binomialstew opened this issue Mar 21, 2023 · 17 comments · Fixed by #1005
Labels

Comments

@binomialstew
Copy link

binomialstew commented Mar 21, 2023

Describe the bug
When importing:

import 'react-tooltip/dist/react-tooltip.css';

I see the following error through eslint:

Resolve error: Package subpath './dist/react-tooltip' is not defined by "exports" in /Users/[username]/Sites/[projectname]/node_modules/react-tooltip/package.json

I'm not sure exactly where './dist/react-tooltip' is being requested (not in my codebase), but adding this to the react-tooltip package exports resolves it:

"exports": {
    ...
    "./dist/react-tooltip": "./dist/react-tooltip.cjs.js"
  },

Version of Package
v5.10.1-beta.4

@danielbarion
Copy link
Member

hi @binomialstew can you check our PRs and the comments (beta releases) and let me know if the latest beta releases work for you?

#984 yarn add react-tooltip@5.10.1-beta-10 - rollup

#982 yarn add react-tooltip@5.10.1-beta-9 - esbuild

@binomialstew
Copy link
Author

binomialstew commented Mar 22, 2023

I still see this issue in both react-tooltip@5.10.1-beta-10 and react-tooltip@5.10.1-beta-9. 10 also contains this more serious issue for us. 9 has this one.

I think this should be added to package exports: "./dist/react-tooltip": "./dist/react-tooltip.cjs.js"

@gabrieljablonski
Copy link
Member

Hey @binomialstew

Following up on this issue, could you please test react-tooltip@5.10.2-beta.4 and let us know if this specific problem still happens? We'll be addressing each issue that's still open to see if the rollup build still has stuff we have to fix.

@binomialstew
Copy link
Author

@gabrieljablonski, I do still see this warning using react-tooltip@5.10.2-beta.4.

@gabrieljablonski
Copy link
Member

gabrieljablonski commented Apr 1, 2023

Whenever you get the time, if you could provide a sample repository where we can reproduce this warning, it would help us immensely.

@binomialstew
Copy link
Author

@gabrieljablonski, here you go. If you clone it and run npm ci, you should see the warning in your editor upon opening src/app.js. You should also see the warning in your terminal when running npm run start.
Screen Shot 2023-04-06 at 12 42 13 PM

@gabrieljablonski
Copy link
Member

Thanks for taking the time. Can confirm that editing the package.json manually with

"exports": {
    ...
    "./dist/react-tooltip": "./dist/react-tooltip.cjs.js"
  },

fixes it, though I'm not sure if cjs or esm would be the most appropriate mode for this entry.

This issue (#987) along with #1000 and #1002 can definitely all be fixed together. Whenever @danielbarion has the time, he'll look into fixing all of these properly.

Thanks for reporting!

@binomialstew
Copy link
Author

Can confirm that editing the package.json manually

Confirmed. Both cjs or esm works to kill the warning.

Thanks for taking care of it!

@danielbarion
Copy link
Member

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

Beta version:

yarn add react-tooltip@5.10.6-beta.1005.1

or

npm i react-tooltip@5.10.6-beta.1005.1

PS: I didn't add the entry that @gabrieljablonski mentioned in this beta release, but if this one doesn't work, I can add and release a new beta version.

@binomialstew
Copy link
Author

@danielbarion , react-tooltip@5.10.6-beta.1005.1 doesn't correct the issue

@danielbarion
Copy link
Member

thanks for confirming @binomialstew

And this one?

Beta version:

yarn add react-tooltip@5.10.6-beta.1005.2

or

npm i react-tooltip@5.10.6-beta.1005.2

Commit: 74327ca

@binomialstew
Copy link
Author

thanks for confirming @binomialstew

And this one?

Beta version:

yarn add react-tooltip@5.10.6-beta.1005.2

or

npm i react-tooltip@5.10.6-beta.1005.2

Commit: 74327ca

This fixes it, yes.

@binomialstew
Copy link
Author

Is this fixed in v5.10.6.

@gabrieljablonski
Copy link
Member

Is this fixed in v5.10.6.

Not yet, we're reviewing #1005 and react-tooltip@5.10.7 should be released by tomorrow with the fix.

@gabrieljablonski
Copy link
Member

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

@binomialstew
Copy link
Author

This doesn't correct the issue and I see the exports don't have the ones that are needed. In v5.11.1:

 "exports": {
    ".": "./dist/react-tooltip.cjs.js",
    "./dist/*.js": "./dist/*.js",
    "./dist/react-tooltip.css": "./dist/react-tooltip.css",
    "./package.json": "./package.json"
  },

In the one I confirmed is fixed:

"exports": {
    ".": {
      "types": "./dist/react-tooltip.d.ts",
      "require": "./dist/react-tooltip.min.cjs",
       "import": "./dist/react-tooltip.min.mjs",
       "default": "./dist/react-tooltip.min.cjs"
     },
     "./dist/react-tooltip": "./dist/react-tooltip.min.cjs",
     "./dist/react-tooltip.css": "./dist/react-tooltip.min.css",
     "./dist/react-tooltip.d.ts": "./dist/react-tooltip.d.ts",
     "./package.json": "./package.json"
  },

@danielbarion
Copy link
Member

danielbarion commented Apr 11, 2023

thanks for letting us know!

We'll do a new release with the exports updated soon.

Edit, please check the source code, they are the same as you described: https://github.com/ReactTooltip/react-tooltip/blob/master/package.json#L37

If you need, please create a new issue, thanks!

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

Successfully merging a pull request may close this issue.

3 participants