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

Incorrect exports specified in package.json #96

Open
rektdeckard opened this issue Apr 24, 2024 Discussed in #95 · 2 comments
Open

Incorrect exports specified in package.json #96

rektdeckard opened this issue Apr 24, 2024 Discussed in #95 · 2 comments

Comments

@rektdeckard
Copy link
Member

Discussed in #95

Originally posted by diegolauar April 23, 2024
If you get this error: Failed to resolve entry for package "@phosphor-icons/react". The package may have incorrect main/module/exports specified in its package.json.

Try install: npm install phosphor-react

Use: import { . . . } from "phosphor-react"

@rektdeckard
Copy link
Member Author

rektdeckard commented Apr 24, 2024

@diegolauar can you provide some details:

  • @phosphor-icons/react version
  • Project type (pure React, Next, Astro, etc.) and version
  • Build tooling (vite, turbo, etc.) and version
  • Node version
  • Any supporting context that can help reproduce and diagnose the error

@noseworthy
Copy link

I'm having a similar issue. I'm using the vite esm and typescript template to build a pure react app. Here's my environment:

@phosphor-icons/react: 2.1.7
react: 18.3.3
vite: 5.3.5
typescript: 5.5.4
node.js: 18.20.4

TypeScript complains if moduleResolution is set to "bundle" as the default vite template does, so I've changed it to NodeNext. This allows the app to build properly and vite can run it. Unfortunately when I add @phosphor-icons/react to the project, I'm unable to import any components from @phosphor-icons/react directly:

import { FolderOpen, PlusSquare } from '@phosphor-icons/react';

This results in the following typescript error:

❯ yarn build
src/App.tsx:1:10 - error TS2305: Module '"@phosphor-icons/react"' has no exported member 'FolderOpen'.

1 import { FolderOpen, PlusSquare } from '@phosphor-icons/react';

However, if I use the fully qualified exports, everything works fine:

// This works fine
import { FolderOpen } from '@phosphor-icons/react/FolderOpen';
import { PlusSquare } from '@phosphor-icons/react/PlusSquare';

Any thoughts?

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

No branches or pull requests

2 participants