Describe the bug
I think in the last few releases there's been a degradation in the import resolution for this package.
I first encountered issues with "ReferenceError: exports is not defined" when running vitest in my project. @phosphor-icons/react is a dependency of a package I'm using, so it took me a bit to figure out where/why I was hitting this issue. It could also be an issue of the consuming package but I've also noticed just downgrading to 2.1.8 works.
Steps to Reproduce
I am using https://arethetypeswrong.github.io/ to illustrate the issue while I work on creating a minimal repo with reproduction steps (its not trivial, because I think I need to create some mix of ESM / CJS scenario to hit the issue).
Expected behavior
Clean imports without errors
Screenshots
2.1.8 looks decent
pnpm attw --pack .
@phosphor-icons/react v2.1.8
Build tools:
- @arethetypeswrong/cli@^0.18.1
- typescript@^5.8.3
- vite@^6.3.5
π Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug (https://github.com/microsoft/TypeScript/issues/50762). It may misrepresent the runtime behavior of this import and should not be relied upon. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FallbackCondition.md
π Syntax detected in the module is incompatible with the module kind according to the package.json or file extension. This is an error in Node and may cause problems in some bundlers. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UnexpectedModuleSyntax.md
ββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β β node10 β node16 (from CJS) β node16 (from ESM) β bundler β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react" β π’ β π’ (CJS) β π Used fallback condition β π Used fallback condition β
β β β β π Unexpected module syntax β β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/icons/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/csr/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/lib/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/ssr" β π’ β π’ (CJS) β π Used fallback condition β π Used fallback condition β
β β β β π Unexpected module syntax β β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/ssr/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/package.json" β π’ (JSON) β π’ (JSON) β π’ (JSON) β π’ (JSON) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββ
pnpm dlx @arethetypeswrong/cli --pack .
@phosphor-icons/react v2.1.9
Build tools:
- typescript@^5.8.3
- vite@^6.3.5
β οΈ A require call resolved to an ESM JavaScript file, which is an error in Node and some bundlers. CommonJS consumers will need to use a dynamic import. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSResolvesToESM.md
π Syntax detected in the module is incompatible with the module kind according to the package.json or file extension. This is an error in Node and may cause problems in some bundlers. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UnexpectedModuleSyntax.md
π₯΄ Import found in a type declaration file failed to resolve. Either this indicates that runtime resolution errors will occur, or (more likely) the types misrepresent the contents of the JavaScript files. Use -f json to see the imports that failed to resolve. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/InternalResolutionError.md
π Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug (https://github.com/microsoft/TypeScript/issues/50762). It may misrepresent the runtime behavior of this import and should not be relied upon. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FallbackCondition.md
ββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β β node10 β node16 (from CJS) β node16 (from ESM) β bundler β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react" β π’ β β οΈ ESM (dynamic import only) β π₯΄ Internal resolution error β π Used fallback condition β
β β β π Unexpected module syntax β π Used fallback condition β β
β β β π₯΄ Internal resolution error β β β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/icons/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/csr/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/lib/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/ssr" β π’ β π Unexpected module syntax β π₯΄ Internal resolution error β π Used fallback condition β
β β β β οΈ ESM (dynamic import only) β π Used fallback condition β β
β β β π₯΄ Internal resolution error β β β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/ssr/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/package.json" β π’ (JSON) β π’ (JSON) β π’ (JSON) β π’ (JSON) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββ΄βββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββ
pnpm dlx @arethetypeswrong/cli --pack .
@phosphor-icons/react v2.1.10
Build tools:
- typescript@^5.8.3
- vite@^6.3.5
β οΈ A require call resolved to an ESM JavaScript file, which is an error in Node and some bundlers. CommonJS consumers will need to use a dynamic import. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSResolvesToESM.md
π Syntax detected in the module is incompatible with the module kind according to the package.json or file extension. This is an error in Node and may cause problems in some bundlers. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UnexpectedModuleSyntax.md
π₯΄ Import found in a type declaration file failed to resolve. Either this indicates that runtime resolution errors will occur, or (more likely) the types misrepresent the contents of the JavaScript files. Use -f json to see the imports that failed to resolve. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/InternalResolutionError.md
π Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug (https://github.com/microsoft/TypeScript/issues/50762). It may misrepresent the runtime behavior of this import and should not be relied upon. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FallbackCondition.md
π Import failed to resolve to type declarations or JavaScript files. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md
ββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β β node10 β node16 (from CJS) β node16 (from ESM) β bundler β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react" β π’ β β οΈ ESM (dynamic import only) β π₯΄ Internal resolution error β π Used fallback condition β
β β β π Unexpected module syntax β π Used fallback condition β β
β β β π₯΄ Internal resolution error β β β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/icons/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/csr/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/lib/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/lib" β π Resolution failed β π Unexpected module syntax β π₯΄ Internal resolution error β π Used fallback condition β
β β β β οΈ ESM (dynamic import only) β π Used fallback condition β β
β β β π₯΄ Internal resolution error β β β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/ssr" β π’ β π Unexpected module syntax β π₯΄ Internal resolution error β π Used fallback condition β
β β β β οΈ ESM (dynamic import only) β π Used fallback condition β β
β β β π₯΄ Internal resolution error β β β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/ssr" β π Resolution failed β π Unexpected module syntax β π₯΄ Internal resolution error β π Used fallback condition β
β β β π₯΄ Internal resolution error β π Used fallback condition β β
β β β β οΈ ESM (dynamic import only) β β β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/dist/ssr/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/package.json" β π’ (JSON) β π’ (JSON) β π’ (JSON) β π’ (JSON) β
ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β "@phosphor-icons/react/*" β (wildcard) β (wildcard) β (wildcard) β (wildcard) β
ββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββ
Context (please complete the following information):
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M2 Pro
Memory: 456.81 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.19.2 - ~/Library/pnpm/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.8.2 - ~/Library/pnpm/npm
pnpm: 10.6.3 - ~/Library/pnpm/pnpm
bun: 1.2.16 - ~/.bun/bin/bun
Watchman: 2025.05.26.00 - /opt/homebrew/bin/watchman
Additional notes
Might be related to: #133 , #96
Describe the bug
I think in the last few releases there's been a degradation in the import resolution for this package.
I first encountered issues with "ReferenceError: exports is not defined" when running
vitestin my project.@phosphor-icons/reactis a dependency of a package I'm using, so it took me a bit to figure out where/why I was hitting this issue. It could also be an issue of the consuming package but I've also noticed just downgrading to2.1.8works.Steps to Reproduce
I am using https://arethetypeswrong.github.io/ to illustrate the issue while I work on creating a minimal repo with reproduction steps (its not trivial, because I think I need to create some mix of ESM / CJS scenario to hit the issue).
Expected behavior
Clean imports without errors
Screenshots
2.1.8 looks decent
Context (please complete the following information):
Additional notes
Might be related to: #133 , #96