Image error
Unanswered
βπΆπ posted this in #help-forum
Hiya there im on Nextjs V14 with chakra ui version 2.2.1 and I'm having some errors
So this is how im using the library rn https://cordx.lol/users/787241442770419722/hSRpizfL.png and btw the next/image is already import. but it gives me error - https://cordx.lol/users/787241442770419722/6n8o2Qrn.png
So this is how im using the library rn https://cordx.lol/users/787241442770419722/hSRpizfL.png and btw the next/image is already import. but it gives me error - https://cordx.lol/users/787241442770419722/6n8o2Qrn.png
55 Replies
you need to configure nextjs to use remote urls
@βπΆπ like?
read the docs
i have already configured everything
/**
* NEXT.JS CONFIGURATION FILE
* ==========================
*/
/** @type {import('next').NextConfig} */
const withPWA = require("next-pwa")({
register: true,
dest: "public",
disable: process.env.NODE_ENV == "development",
});
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true" ? true : false,
openAnalyzer: false,
});
const nextConfig = {
async headers() {
return [
{
source: "https://api.topiclist.xyz/:path*",
headers: [
{ key: "Access-Control-Allow-Credentials", value: "true" },
{ key: "Access-Control-Allow-Origin", value: "*" },
{
key: "Access-Control-Allow-Methods",
value: "GET,DELETE,PATCH,POST,PUT",
},
{
key: "Access-Control-Allow-Headers",
value:
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version",
},
],
},
];
},
};
module.exports = nextConfig;
module.exports = withBundleAnalyzer(
withPWA({
swcMinify: true,
compress: true,
optimizeFonts: true,
images: {
formats: ["image/avif", "image/webp"],
dangerouslyAllowSVG: true,
unoptimized: true,
remotePatterns: [
{
protocol: "https",
hostname: "cdn.topiclist.xyz",
pathname: "/images/**",
},
{
protocol: "https",
hostname: "beta.cordx.lol",
},
],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 100, 128, 150, 256, 384],
},
env: {
apiUrl: process.env.apiUrl,
},
}),
);here is my full next.config.js
@βπΆπ okay?
you sure you sent the correct screenshot? the error says it got
0pxas width@βπΆπ yes
try to remove the
.next folder and start the dev server againoki
hiya its fixed but now another error lol
it needs a numeric value
ohyeah sorry
set it to
width={100} and height={100}try to search for
0px in your fileits in many place lol
it should not interfear with the "https://cdn.topiclist.xyz/images/png/TopicList5.png"
@βπΆπ https://cordx.lol/users/787241442770419722/cW3dnxZo.mp4
if they are props for an Image tag you have to fix them
please create a reproduction repository
thats a really hard task
@@ts-ignore https://nextjs-faq.com/minimal-reproduction-repository
my code is heavily dependend on other components
and that also depend on another and cycle goes on
@βπΆπ and that also depend on another and cycle goes on
create a new repo with same nextjs version, setup the remote urls and add an image tag with same attributes
oki
@βπΆπ https://github.com/Miya25/nextjs-5/tree/main
it works, there is smth wrong with the code you wrote then
if not
then I think you should create an issue on nextjs repo
@@ts-ignore i removed all things containing
so in theory
the error should be gone
then I think it is a bug with nextjs and you can create an issue
https://cordx.lol/users/787241442770419722/99TY5Xb1.png but i get this
even thoall mention to the url
are gone