psychobolt/react-pie-menu

NPM repository has old version of package.json

Closed this issue · 9 comments

NPM repository version has the following for peer dependencies
"peerDependencies": { "react": "^17.0.2", "react-dom": "^17.0.2", "styled-components": "^5.2.3" }
but the Github version has
"peerDependencies": { "react": "^17.0.2 || ^18.0.0", "react-dom": "^17.0.2 || ^18.0.0", "styled-components": "^5.2.5" },

As a result, I'm unable to update the react version in my project even though react-pie-menu apparently supports version ^8.0.0.

Hi try upgrade to 1.0.0-alpha.1

1.0.0-alpha.1

Thank you, that resolved the issue!

Do you have a sample repo or code, which I can reproduce the issue? Please provide more than error.

Following note on the update for 1.0.x:

  1. Default import import PieMenu from 'react-pie-menu -> import { PieMenu } from 'react-pie-menu'
  2. There is update to support conditional export to allow both commonjs and ESM consumers for modern web bundlers (like webpack or rollup) match their package's type or resolve configs.

Personal findings and thoughts for (2):

As described in the official TypeScript docs, tscompilier would resolve to "main" or "import". I suspect, somehow package resolution is not adhering react-pie-menu's exports. I don't have a TypeScript project to test on, however it's possible to change or alias your imports to direct resolution. Either import { PieMenu } from 'react-pie-menu/dist/index.prod.cjs.mjs' or const { PieMenu } = require('react-pie-menu/dist/index.dev.cjs') or import { PieMenu } from 'react-pie-menu/dist/index.prod.js' (production) / import { PieMenu } from 'react-pie-menu/src/index.js (dev). Meantime, you can also give one of these imports a try.

Unfortunately, the repo is private. However, changing the import to direct resolution worked! I'm still not sure why that is the case. Like I said, it's odd that with the 0.3.3 version, the named module resolution works but not with 1.0.0-alpha.1. Regardless, importing from the direct path like the following is a good enough work around for me. Thanks for your help and the great module!

import { PieMenu, PieCenter, Slice, //@ts-expect-error can not find declaration } from '../../../node_modules/react-pie-menu';

Hi, I've run into the module issue as well and I think the problem is that the npm package's dist does not include any of the index.dev.* files, and the package.json's exports.development configs say to use the .dev files.

You can see this reproduced on my branch https://github.com/keyserj/ameliorate/tree/pie-import-issue by cloning and running

cd web
npm i
npm run dev # open localhost:3000 and see the `module not found` error in devtools console and terminal output
# ctrl+c cancel running
npm run build # production build
npm run start # open localhost:3000 and a terribly-used-but-working react pie menu

I confirmed that yarn build creates the dist/index.dev.* files - I wonder if you published the package unintentionally without them, and just need to republish with them?

@keyserj There is definitely a discrepancy in dist files between alpha.0 and alpha.1 although I don't believe your issue is related to the OP's. I will publish another version.

works 🔥 thanks!