Coder Social home page Coder Social logo

Comments (23)

rektdeckard avatar rektdeckard commented on April 30, 2024 5

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.

schardev avatar schardev commented on April 30, 2024 2

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

rektdeckard avatar rektdeckard commented on April 30, 2024 1

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

omridevk avatar omridevk commented on April 30, 2024

same here

from react.

omridevk avatar omridevk commented on April 30, 2024

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

oscadev avatar oscadev commented on April 30, 2024

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.

oscadev avatar oscadev commented on April 30, 2024

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

IvanNavin avatar IvanNavin commented on April 30, 2024

@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.
Знімок екрана 2024-04-03 о 07 10 41

from react.

xwu-alterdomus avatar xwu-alterdomus commented on April 30, 2024

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.

fanzypantz avatar fanzypantz commented on April 30, 2024

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.

derFBeste avatar derFBeste commented on April 30, 2024

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.

fanzypantz avatar fanzypantz commented on April 30, 2024

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

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.

schardev avatar schardev commented on April 30, 2024

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

fanzypantz avatar fanzypantz commented on April 30, 2024

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.

ndom91 avatar ndom91 commented on April 30, 2024

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.

schardev avatar schardev commented on April 30, 2024

Importing like so as it reduces the number of modules next.js includes

@ndom91 have you tried optimizePackageImports?

from react.

lcvbeek avatar lcvbeek commented on April 30, 2024

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

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",

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.

rektdeckard avatar rektdeckard commented on April 30, 2024

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.

rektdeckard avatar rektdeckard commented on April 30, 2024

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.

schardev avatar schardev commented on April 30, 2024

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.

rektdeckard avatar rektdeckard commented on April 30, 2024

Seems to have done the trick. I'm marking as resolved.

from react.

IvanNavin avatar IvanNavin commented on April 30, 2024

Thank you all very much

from react.

omridevk avatar omridevk commented on April 30, 2024

Thanks @rektdeckard !

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.