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
Bumping next.js version to v10.0.6 breaks build #1289
Comments
Hi @domano, I've found the culprit. In v10.0.6, the Next team decided to inline webpack and remove it as an npm dependency. This commit does it. Tried seeing if Cosmos can work with the inlined copy at Babel was also inlined in Next one patch version earlier in 10.0.5. This commit does it. In the process the inlined babel-loader was moved from |
Started a conversation in the Next repo vercel/next.js#21746 |
Has anyone got a workaround? Adding a direct dependency on |
Best thing you can do right now is downgrade to |
Update: No reply from the Next community as to how reuse their inlined webpack copy. I fiddled a bit more with reading and initialising Next's inlined webpack copy in Cosmos, and I think I made some progress, but the thing is, there are other packages also that expect webpack to be installed (ie. have webpack as a peer dependency). So even after I made Next's webpack available in Cosmos, I got this error from
I tried installing webpack and Babel manually in this Next example repo and it worked for me: https://github.com/react-cosmos/react-cosmos-nextjs/pull/1/files. Can you give it another try with the latest versions? And if installing webpack fails in your projects, what is the error? Thanks for your patience on this, it's a tough one for me because my hands are tied. |
Trying to install for the first time on an existing Next.js app and was a bit perplexed when asked to install webpack. After I saw this issue I backed down to and pinned
Then backed down to and pinned
Given imports are working fine in my Next app I assumed they'd just start working with Cosmos. Am I missing something? Should I open a separate issue? It's not clear to me if these issues are somehow related to Next integration in general. Thank you! 🙏🏼 |
@balibebas Sorry for all the issues you're having. Did you already follow the Next.js section? |
I did. I'll look at it more today and open a separate issue after another look. Love the dark UI of this project and pleased there are mature, focused alternatives to Storybook. EDIT: For what it's worth I've see the exact same kinds of resolution issues with Storybook, so I assume the problem is each tool not reading the Next config to determine (a) webpack module aliases and/or (b) typescript |
The linked Next.js issue was closed on March 1 with this PR. I tried upgrading to that version of Next (or the latest, So I guess there is now some work to be done on the Cosmos side? Or are we still waiting for further changes in Next before Cosmos can use Next's webpack? Or is there any kind of workaround we could use today? What's the actual problem - does Cosmos need to somehow read the webpack config from |
I don't see how that PR addresses the issue, which is that Next inlined webpack in their codebase and doesn't install it as a npm dependency. Not only that, but last time I checked the embedded webpack inside Next wasn't accessible to be used by 3rd party libraries like Cosmos. There is a chance that the PR you mentioned made the inlined Next webpack usable by outside libs, but someone will have to try this out. You could potentially import On the Cosmos side making a Next-specific adjustment would be easy. We already have a function that looks for webpack in the user's codebase and we could extend it to check if it's inside a Next codebase and import Next's webpack instead. react-cosmos/packages/react-cosmos/src/plugins/webpack/shared.ts Lines 4 to 15 in 2d06f22
|
With |
Same issue, coming from Nextjs v11.0.1 here |
I got it working with Webpack 5, i installed webpack 5 again even tho i think it comes with next js. Here is the error ERROR in ./components/layout/student_pages/sidebar/Sidebar.jsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /home/sidwebworks/Desktop/Github/peerup-webapp-alpha/components/layout/student_pages/sidebar/Sidebar.jsx: Support for the experimental syntax 'jsx' isn't currently enabled (117:3): |
Adding my own Any suggestion on how I might do that @skidding ? I was initially thinking about having to modify the websocket data that gets send to the client when there is an error. But since the view is inside an iframe shouldn't it be possible to render the error modal in there without much additional setup? Basically I want my React Cosmos to also display the |
I was by the way able to get hotReload without the infinite reload bug by setting |
Hi! Any updates for the current versions of react-cosmos and next.js? |
Oh yeah! :) Just done making Cosmos work with Server Components and got it working with Next 13. In the process of ironing out the details and publishing a docs guide. |
Next 13 and React Server Components support is here 🎉 |
What's wrong?
After upgrading my app from next v10.0.5 to 10.0.6 webpack from next is not detected.
Steps to reproduce
(3. Doing so breaks the build due to some obscure loader chaining issue - but i think that installing an additional webpack dep should not be done anyways )
Screenshots
User info
Additional context
I am using tailwindcss with the required loaders ( works with next 10.0.5 )
The text was updated successfully, but these errors were encountered: