-
-
Notifications
You must be signed in to change notification settings - Fork 29
Next 12.1.5 error: Failed to parse src "static/media/public/nyan-cat.png" #72
Comments
Thanks for opening the issue! Do you currently have a workaround? |
No workaround currently, other than just using Next 12.1.4. Seems like maybe a lot of changes under the hood to next/image in 12.1.5. |
I am experiencing the same issue. I was wondering why, but @rsanchez is probably correct. |
Experiencing the same issue. Reverting to |
So it seems that the following code no longer works // .storybook/preview.js
import * as NextImage from "next/image";
const OriginalNextImage = NextImage.default;
Object.defineProperty(NextImage, "default", {
configurable: true,
value: (props) => <OriginalNextImage {...props} unoptimized />,
}); This has been the convention to getting I will continue to look into this, but if anyone has any insight, feel free to chip in. A more detailed explanation for why this error is occurring is that when |
Like @jeroenroumen-acc , rollback to |
Thank you all for your patience! I'm working with Next.js to figure out what the issue exactly is and how to remediate it |
To make Next/Image can be rendered in Storybook mitigate bug from Next.js side ref: RyanClementsHax/storybook-addon-next#72
`next/image`, hostname "avatars.githubusercontent.com" is not configured under images in your `next.config.js` see: RyanClementsHax/storybook-addon-next#72
Update: There is a tentative workaround here. It should be good enough for most use cases |
@RyanClementsHax Thanks for tracking this down. Is that fix something you plan to incorporate into this plugin? Or are you suggesting we use that fix in our own code? |
I might put it in the repo but I was hoping to have clarification from the nextjs team if this is a bug on their end first. I'm kinda torn on what to do. Put a workaround in this repo and risk breaking changes for y'all if nextjs decides to fix this problem, or wait until a decision is reached so we can implement a proper fix if needed. |
🎉 This issue has been resolved in version 1.6.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thanks all for your patience. I know this was frustrating. |
I can confirm that after updating to "storybook-addon-next": "1.6.4" |
NextJS no longer requires a bit of code added in to patch a bug that existed in Next v12.1.5 and above. As of v12.2.0, this patch is no longer needed, and furthermore causes a `TypeError` to be thrown when attempting to ugprade to Next 12. Fixes: RyanClementsHax#95 Related: RyanClementsHax#72
Describe the bug
As of Next 12.1.5, this addon no longer seems to work with Next Image.
Full error message:
Your minimal, reproducible example
https://github.com/rsanchez-forks/storybook-addon-next/tree/next-12.1.5-issue/examples/nextv12
Steps to reproduce
examples/nextv12
, runyarn add next@12.1.5
yarn storybook
Expected behavior
As a user, expect next-image to work within Storybook.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
storybook-addon-next version
Main branch, Commit hash a7efc09
Additional context
Next 12.1.4 does not have the same issue.
The text was updated successfully, but these errors were encountered: