Comments (23)
Hi all, apologies for delay in resolving this! Testing the hypothesis that it is caused by relying on automatic JSX runtime, as @omridevk suggests. I will be pushing some pre-release updates to NPM shortly and would appreciate some help testing, as many of these problems are intractable and arise from specific nuances of project setup.
from react.
@rektdeckard Could be related to this ? 2f22ef1 not sure though. I assume some build issue since it is weird to ship "node_modules" inside of a dist directory.
Yep. It looks to be this. I fixed it by installing the 2.1.3
package which was released on npm
but was never published here on github. It is probably some weird bundling issue but then again why do we even need to ship node_modules
with specific react version?
from react.
@schardev it won't work (or at least will error and require an additional package to be installed) for users of react@16
and below. There are still tons of apps running 16.8, and I didn't want to hurt the dev experience there. Impact should really be minimal.
from react.
same here
from react.
@rektdeckard
Could be related to this ?
2f22ef1
not sure though.
I assume some build issue since it is weird to ship "node_modules" inside of a dist directory.
from react.
Same here. Cannot use IconContext.Provider in _app.tsx in a Next JS (pages router) app, or I get the "Did you mean to import "react/index.js"?" crash
from react.
@IvanNavin I fixed it. It is because you are importing the ssr version instead of the normal react version. Change your ic import to "import { ArrowArcRight } from "@phosphor-icons/react";" instead of "import { ArrowRight } from "@phosphor-icons/react/dist/ssr";
Update: It was a fluke, or something. The problem is back.
from react.
@oscadev I would be very happy to fix this using that approach, but I don't have a path like '@phosphor-icons/react/dist/ssr' anywhere.
from react.
Any update for this issue. it works as expected inprevious version, that is 2.0.15
here are my local env:
- nextjs : 13.2.4
- React: 18.2.0
- react-dom:18.2.0
- @phosphor-icons/react: 2.1.4
- nodejs: 18.20.0
- dockerimage: node:18-alpine
from react.
Can confirm I am seeing the same issue on 2.0.14, building a docker image for production in node:20.10.0
from react.
Same here. I updated to Nextjs 14 and React to 18 along with that and that's when the issue started.
- nextjs: 14.1.4
- React: 18.2.0
- react-dom: 18.2.0
- @phosphor-icons/react: 2.1.4
- nodejs: 20.12.1
- package manager: pnpm
Using next dev --turbo
to run my dev takes care of the error. Maybe a webpack issue?
from react.
@rektdeckard Could be related to this ? 2f22ef1 not sure though. I assume some build issue since it is weird to ship "node_modules" inside of a dist directory.
Yep. It looks to be this. I fixed it by installing the
2.1.3
package which was released onnpm
but was never published here on github. It is probably some weird bundling issue but then again why do we even need to shipnode_modules
with specific react version?
Are you sure you didn't have this cached? I can't get any of the mentioned versions working nor my old version of 2.0.13
after doing yarn cache clean
My versions:
Node: 20.10.0
"@phosphor-icons/react": "^2.1.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
next": "^12.3.1",
from react.
@fanzypantz yep. I checked it after I did yarn cache clean
. Here are my versions:
"dependencies": {
"@phosphor-icons/react": "2.1.3",
"next": "14.1.4",
"react": "18.2.0",
"react-dom": "18.2.0",
}
from react.
The weird thing, is that this works on my coworkers computer, he also did the cache cleaning, and a random local Linux server we have for development. Edit: He could not build the docker image
But not in our dockerimage, or my local computer. The Dockerfile isn't especially complicated.
# Node version
FROM node:20.10.0 AS builder
ENV NEXT_PUBLIC_API_ENDPOINT=
ENV NEXT_PUBLIC_BASE_URL=
# Install required build tools
RUN apt-get update && \
apt-get -y install gcc
# Create app directory
WORKDIR /app
# Add the source code to app
COPY package*.json ./
COPY lerna.json ./
COPY /packages ./packages
# Install all the dependencies
RUN yarn install
RUN yarn global add tscpaths
COPY . .
# Generate the build of the application
RUN yarn build
FROM node:20.10.0 AS runner
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/packages ./packages
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/lerna.json ./
EXPOSE 3000
CMD [ "yarn", "start" ]
from react.
Seeing this issue with the following dependencies as well when we upgraded to 2.1.4
.
"dependencies": {
"@phosphor-icons/react": "^2.1.4",
"next": "14.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
}
Importing like so as it reduces the number of modules next.js includes
import { Flask } from "@phosphor-icons/react/dist/csr/Flask"
Downgrading back to @phosphor-icons/[email protected]
seems to have fixed it again.
from react.
Importing like so as it reduces the number of modules next.js includes
@ndom91 have you tried optimizePackageImports
?
from react.
@rektdeckard Could be related to this ? 2f22ef1 not sure though. I assume some build issue since it is weird to ship "node_modules" inside of a dist directory.
Yep. It looks to be this. I fixed it by installing the
2.1.3
package which was released onnpm
but was never published here on github. It is probably some weird bundling issue but then again why do we even need to shipnode_modules
with specific react version?Are you sure you didn't have this cached? I can't get any of the mentioned versions working nor my old version of
2.0.13
after doingyarn cache clean
My versions:
Node: 20.10.0
"@phosphor-icons/react": "^2.1.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
next": "^12.3.1",
Make sure to use "2.1.3"
and not "^2.1.3"
, as this will still resolve to install "2.1.4"
;)
Check your yarn.lock
for what it's actually installing.
from react.
Have published an alpha that reverts to classic JSX runtime. Checked out locally with [email protected]
, [email protected]
, [email protected]
on Node 20, but help testing is appreciated!
pnpm install @phosphor-icons/react@next
# ^ or @2.1.5-alpha.3
from react.
We had in fact been bundling the automatic JSX runtime, which was expecting to find a version of react
in a sibling directory rather than as a global.
This was a non-issue in most builds, since the end-user's build tooling was probably also using automatic JSX runtime, consuming the ESM build of this library, and thus performing the JSX transform itself.
I don't see any harm in reverting to classic JSX runtime. It has marginal performance and bundle impacts, so going ahead and shipping this.
from react.
Can confirm updating to 2.1.5
fixed it for me. Thanks 👍
EDIT:
I don't see any harm in reverting to classic JSX runtime
@rektdeckard was there an issue by externalizing the react/jsx-runtime
package? (I can see that you reverted it in ad5be55)
from react.
Seems to have done the trick. I'm marking as resolved.
from react.
Thank you all very much
from react.
Thanks @rektdeckard !
from react.
Related Issues (20)
- Add `@preview` tag to enable icon previews in jsdoc HOT 4
- Could not find a declaration file when using SSR HOT 2
- SSR Components missing default size="1em"
- SSR component types are not resolving
- allow to add Contributing.md file.
- Importing icons from `@phosphor-icons/react/dist/ssr` renders the icons, but gives issues in the editor HOT 5
- TypeError: Cannot create property 'displayName' on number 'Infinity' HOT 7
- Unble to dynamic import icons .mjs extensions HOT 9
- Icon instance className overwrites context className HOT 8
- New Twitter (x.com) icon? HOT 1
- Cannot find package on node 20 HOT 6
- ./node_modules/@phosphor-icons/react/dist/lib/context.mjs Can't import the named export 'createContext' from non EcmaScript module (only default export is available) HOT 10
- 'use client' in client icons and IconContext HOT 2
- React warning after update to 2.1.4 HOT 1
- Issue updating past 2.1.3 HOT 2
- Incorrect exports specified in `package.json` HOT 1
- Jest test fails if importing directly from `/dist` folder
- Custom icons: Typescript and ESLint errors in Next.js 14 HOT 1
- React web pack build error in phosphor icons HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.