Replies: 1 comment
-
This would be great, +1 for anything that makes it easier to use Unpic |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
No response
Background
I am the maintainer of Unpic, a popular cross-platform image component library. One of our supported frameworks is Next.js, which we handle via a custom component. In this component we import
ImageConfigContext
so that the user's remote patterns and breakpoints are respected. This allows us to use the Next.js image server and Vercel image CDN for images that are not served from a third party CDN. We do this in the same way as the standard next/image component, by importing it from the internal "next/dist/shared/lib/image-config-context.js" path. I am aware this is a private API, but I don't know of another way to respect the user's preferences.In Next.js 14, the path to the context file was changed to "next/dist/shared/lib/image-config-context.shared-runtime.js", breaking the component for users. As a private API this is to be expected. Unfortunately this can't even be worked-around with conditional imports, because builds still fail even if it's not imported. I have had to make it a breaking change, with a new import subpath.
Proposal
Make
ImageConfigContext
a public API, possibly by re-exporting it fromnext/image
. Alternatively, provide another way for components to see the imae config at runtime.Beta Was this translation helpful? Give feedback.
All reactions