phosphor-icons / react

A flexible icon family for React

Home Page:https://phosphoricons.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lib is not exported from package.json

xcxooxl opened this issue · comments

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.

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.

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

@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.