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

lib is not exported from package.json #50

Closed
xcxooxl opened this issue Apr 23, 2023 · 3 comments · Fixed by #52
Closed

lib is not exported from package.json #50

xcxooxl opened this issue Apr 23, 2023 · 3 comments · Fixed by #52
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@xcxooxl
Copy link

xcxooxl commented Apr 23, 2023

I had trouble with tree shaking with next.js so I had to use

  modularizeImports: {
    '@phosphor-icons/react': {
      transform: '@phosphor-icons/react/dist/icons/{{member}}',
    },
}

in my next.config.js to make the tree shaking work, but that broke IconContext because it tried to import it from icons as well.
so I exported it in package.json and now I can import like so:
import { IconContext } from '@phosphor-icons/react/dist/lib/context'

I think the lib inside dist should be exported like the icons.

@rektdeckard
Copy link
Member

rektdeckard commented Apr 24, 2023

I can add the export (I assume you mean add the relevant paths to the exports field in package.json, as the modules ARE already exported in the bundle itself). But what are they smoking at Vercel? This library should be trivially tree shakeable by a competent bundler. It works everywhere else.

@rektdeckard rektdeckard added question Further information is requested bug Something isn't working labels Apr 24, 2023
@rektdeckard rektdeckard self-assigned this Apr 24, 2023
@JipSterk
Copy link

i also experience this issue with the solution you provided here @rektdeckard

@rektdeckard
Copy link
Member

@JipSterk I don't see that as related. You are trying to use the default import of a package that doesn't have one, that's all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants