phosphor-icons / homepage

The homepage of Phosphor Icons, a flexible icon family for everyone
https://phosphoricons.com
MIT License
3.89k stars 93 forks source link

Issues with Vitest/Vite #477

Closed johnnyshankman closed 2 months ago

johnnyshankman commented 2 months ago

Describe the bug

When running a classic Vitest config setup, phosphor icons return errors relating to path imports, possibly due to pnpm.

Steps to Reproduce

Include phosphor icons in a react-vite repo. Then use vitest to test the component.

Behavior:

 FAIL  tests/components/z.test.ts [ tests/components/z.test.ts ]
Error: Cannot find package '/Users/xxxx/Documents/yyyyyy/studio-app-devtools/node_modules/@phosphor-icons/react/dist/node_modules/.pnpm/react@18.2.0/node_modules/react/package.json' imported from /Users/xxxx/Documents/yyyyyy/studio-app-devtools/node_modules/@phosphor-icons/react/dist/node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.production.min.mjs
Did you mean to import react/index.js?
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Expected behavior

Behaves like any other React component dependency and renders like it does in production and in development servers on vite.

Screenshots

Context (please complete the following information):

"vitest": "^1.4.0",
"vite": "^5.2.7",
"@phosphor-icons/react": "^2.1.4",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.3.0"
"@testing-library/react": "^14.1.2",

Additional notes

johnnyshankman commented 2 months ago

Ah woops meant to put this in the react repo... closing and reopening.

rektdeckard commented 2 months ago

Thanks. Looks like it's already reported as https://github.com/phosphor-icons/react/issues/90. Fix is underway.