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
React 18 server components does not work with package from node_modules #36005
Comments
@samuelhulla Can you provide a minimal reproduction for it? More about the code of the pages, can't tell the root cause of the rendering issue based on package.json and next.config |
@huozhi Sorry took me some time to figure out what actually had broken the app as i was not sure if it was crashing due to particular package or folder structure from the original repo, but luckily I got it in a very minimal example, so hopefully it will get us one bit closer to the solution. see https://github.com/samuelhulla/nexitssue Alternatively you can do just npx create-next-app@latest --ts and rename /** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponents: true,
outputStandalone: true,
runtime: 'edge',
},
images: {
formats: ['image/avif', 'image/webp'],
},
swcMinify: true
}
module.exports = nextConfig |
@samuelhulla The error message I got from you reproduction is different: Thought to fix it you need to: move If you found anything new with the original error please keep us posted, thanks |
@huozhi yeah regarding modules that's just from the boilerplate, my bad for not noticing the next/head though. That being said I actually updated my I presume this is outside of the scope of error - ./pages/index.server.tsx:2:0
Module not found: Package path ./?__sc_server__ is not exported from package /Users/samuel/Coding/next12-react18/next12issue/node_modules/framer-motion (see exports field in /Users/samuel/Coding/next12-react18/next12issue/node_modules/framer-motion/package.json)
https://nextjs.org/docs/messages/module-not-found
warn - You are using the experimental Edge Runtime with `experimental.runtime`.
warn - You have experimental React Server Components enabled. Continue at your own risk.
error - Error: Cannot find module '/Users/samuel/Coding/next12-react18/next12issue/.next/server/pages/index.js'
Require stack:
- /Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/require.js
- /Users/amuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/load-components.js
- /Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/build/utils.js
- /Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/build/output/store.js
- /Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/build/output/index.js
- /Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/cli/next-dev.js
- /Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/bin/next Nonetheless, if you feel like giving a quick check yourself, I've updated (pushed) the issue on the same repo |
I changed a bit the server components loader to get rid of the And notice that 3rd party module imports could be problematic at the moment, we're still working on the support of more cases to cover more cases |
@huozhi I did fork the latest canary and link it to my project and it does seemingly fix the issue, so good job on that one. That being said, there are still some issues, with the package using unsupported hooks inside server-side components: Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Error: This Hook is not supported in Server Components.
at Object.unsupportedHook (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:924:9)
at useRef (/Users/samuel/Coding/next12-react18/next12issue/node_modules/react/cjs/react.development.js:1625:21)
at useConstant (webpack-internal:///./node_modules/framer-motion/dist/es/utils/use-constant.mjs:16:60)
at useProjectionId (webpack-internal:///./node_modules/framer-motion/dist/es/projection/node/id.mjs:15:80)
at MotionComponent (webpack-internal:///./node_modules/framer-motion/dist/es/motion/index.mjs:75:130)
at attemptResolveElement (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1039:18)
at resolveModelToJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1320:21)
at Object.toJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:979:14)
at stringify (<anonymous>)
at processModelChunk (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:165:14)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Error: This Hook is not supported in Server Components.
at Object.unsupportedHook (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:924:9)
at useRef (/Users/samuel/Coding/next12-react18/next12issue/node_modules/react/cjs/react.development.js:1625:21)
at useConstant (webpack-internal:///./node_modules/framer-motion/dist/es/utils/use-constant.mjs:16:60)
at useProjectionId (webpack-internal:///./node_modules/framer-motion/dist/es/projection/node/id.mjs:15:80)
at MotionComponent (webpack-internal:///./node_modules/framer-motion/dist/es/motion/index.mjs:75:130)
at attemptResolveElement (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1039:18)
at resolveModelToJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1320:21)
at Object.toJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:979:14)
at stringify (<anonymous>)
at processModelChunk (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:165:14)
Error: This Hook is not supported in Server Components.
at Object.unsupportedHook (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:924:9)
at useRef (/Users/samuel/Coding/next12-react18/next12issue/node_modules/react/cjs/react.development.js:1625:21)
at useConstant (webpack-internal:///./node_modules/framer-motion/dist/es/utils/use-constant.mjs:16:60)
at useProjectionId (webpack-internal:///./node_modules/framer-motion/dist/es/projection/node/id.mjs:15:80)
at MotionComponent (webpack-internal:///./node_modules/framer-motion/dist/es/motion/index.mjs:75:130)
at attemptResolveElement (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1039:18)
at resolveModelToJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1320:21)
at Object.toJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:979:14)
at stringify (<anonymous>)
at processModelChunk (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:165:14)
wait - compiling /_error (client and server)...
wait - compiling...
event - compiled client and server successfully in 39 ms (564 modules)
error - Error: This Hook is not supported in Server Components.
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Error: This Hook is not supported in Server Components.
at Object.unsupportedHook (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:924:9)
at useRef (/Users/samuel/Coding/next12-react18/next12issue/node_modules/react/cjs/react.development.js:1625:21)
at useConstant (webpack-internal:///./node_modules/framer-motion/dist/es/utils/use-constant.mjs:16:60)
at useProjectionId (webpack-internal:///./node_modules/framer-motion/dist/es/projection/node/id.mjs:15:80)
at MotionComponent (webpack-internal:///./node_modules/framer-motion/dist/es/motion/index.mjs:75:130)
at attemptResolveElement (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1039:18)
at resolveModelToJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1320:21)
at Object.toJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:979:14)
at stringify (<anonymous>)
at processModelChunk (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:165:14)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Warning: Only ServerContext is supported in Flight
at ServerComponentWrapper (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:198:35)
at StyleRegistry (/Users/samuel/Coding/next12-react18/next12issue/node_modules/styled-jsx/dist/index/index.js:671:34)
at FlushEffectContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:424:37)
at AppContainer (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:439:29)
at AppContainerWithIsomorphicFiberStructure (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:470:57)
at div
at Body (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/server/render.js:736:21)
Error: This Hook is not supported in Server Components.
at Object.unsupportedHook (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:924:9)
at useRef (/Users/samuel/Coding/next12-react18/next12issue/node_modules/react/cjs/react.development.js:1625:21)
at useConstant (webpack-internal:///./node_modules/framer-motion/dist/es/utils/use-constant.mjs:16:60)
at useProjectionId (webpack-internal:///./node_modules/framer-motion/dist/es/projection/node/id.mjs:15:80)
at MotionComponent (webpack-internal:///./node_modules/framer-motion/dist/es/motion/index.mjs:75:130)
at attemptResolveElement (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1039:18)
at resolveModelToJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1320:21)
at Object.toJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:979:14)
at stringify (<anonymous>)
at processModelChunk (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:165:14)
Error: This Hook is not supported in Server Components.
at Object.unsupportedHook (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:924:9)
at useRef (/Users/samuel/Coding/next12-react18/next12issue/node_modules/react/cjs/react.development.js:1625:21)
at useConstant (webpack-internal:///./node_modules/framer-motion/dist/es/utils/use-constant.mjs:16:60)
at useProjectionId (webpack-internal:///./node_modules/framer-motion/dist/es/projection/node/id.mjs:15:80)
at MotionComponent (webpack-internal:///./node_modules/framer-motion/dist/es/motion/index.mjs:75:130)
at attemptResolveElement (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1039:18)
at resolveModelToJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:1320:21)
at Object.toJSON (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:979:14)
at stringify (<anonymous>)
at processModelChunk (/Users/samuel/Coding/next12-react18/next12issue/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:165:14)
error - Error: This Hook is not supported in Server Components. But this I assume is fully out of your control and needs to be updated on That being said, I find it a bit weird, even if I deliberately mark a component to be rendered on client side, there is a different error: i.e. the structure components/
MotionComponent.tsx # - contains the { motion } import
ClientSideWrapper.client.tsx # - explicit client component
pages/
index.server.tsx - Contains where /* MotionComponent.tsx */
import { motion } from 'framer-motion'
const MotionComponent = () => <motion.div animate={{ scale : 1.2 }}>test</div>
export default MotionComponent
/* ClientSideWrapper.client.tsx */
import MotionComponent from './MotionComponent'
const ClientSideWrapper = () => <MotionComponent />
export default ClientSideWrapper
/* index.server.tsx */
import ClientSideWrapper from '../components/ClientSideWrapper'
const Home: NextPage = () => (
<ClientSideWrapper />
)
export default Home produces the following error: error - Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. whereas I would expect it to work when inside a client side partition of the next app.
|
Would you mind updating the code to the repro you made? I can keep investigating on it 🙏 |
@huozhi No problem, I pushed to master. A small note though, the package.json points to the local version of the current forked canary (the build of the next package is unchanged from the vercel/nextjs canary branch). |
I'm getting this same error. How do you managed to fix this? |
@samuelhulla there's a workaround for your reproduction, you can upgrade to latest canary and change the - import { motion } from 'framer-motion'
+ const { motion } = require('framer-motion') There's sth wrong with esm resolving with RSC we still need to investigate 🤔 |
@CuriosBasant can you create a new issue with reproduction and verify with canary? I'm not sure what's the root cause based on your error trace and that |
@huozhi I can confirm that current canary build fixes the |
No fix as of yet, only a workaround. For now i'm developing on downgraded |
Seems it needs some changes on react side to handle esm import in flight response, react team is aware now and working on it |
@huozhi Thanks a lot! Could you please link me to the thread, I'm kinda curious as to how will they manage to solve this issue (unless it was handled via DM) and happy holidays. 🎉 |
Hi, since Next.js 13, React Server Components is only supported in the If you still have issues, please open a new issue with a reproduction, using |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
~/Coding/portfolio feat/navbar !5 next info ✔ 14:46:22
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Hey, I'm one of the early react 18 + nextjs 12 adopters. It's been (amidst some minor troubleshooting hickups which is to be expected) been working really well.
With the official release of react 18 I've decided to update my current project to the latest version
This however breaks the next application completely.
I've tried all possible combinations of Next and React (including using the
react@rc
andreact-dom@rc
as the official docs suggest, albeit now I believe they are just oudated as the rc is behind the official 18.0.0 release).All the builds fail, unless I downgrade specifically to
next: 12.1.1
(previously I had12.1.1.canary-4
installed). Anything above, including the latest canary just flat out fails with the following error message:I also tried playing with different node and npm versions, but they seem to have no relation as when downgrading to 12.1.1 it works with no matter what node version i have and with anything above it does not work with any of the possible node variations.
Expected Behavior
I'd expect my next application to work with the latest versions of the application.
To Reproduce
Installing
next@canary react@latest react-dom@latest
should be enough to brick.I'll include the rest of my
package.json
here andnext.config
for completion sakeThank you in advance and keep up the great work <3
The text was updated successfully, but these errors were encountered: