brainwave icon indicating copy to clipboard operation
brainwave copied to clipboard

card-1.svg to card-6.svg for the Benefits.jsx section DO NOT render on Vercel

Open GaijinShacho opened this issue 2 years ago • 9 comments

The gradient "frame" svg images in the Benefits section show nicely on localhost but do not render on Vercel.

import benefitCard1 from "./benefits/card-1.svg"; import benefitCard2 from "./benefits/card-2.svg"; import benefitCard3 from "./benefits/card-3.svg"; import benefitCard4 from "./benefits/card-4.svg"; import benefitCard5 from "./benefits/card-5.svg"; import benefitCard6 from "./benefits/card-6.svg";

Please check it yourself here: https://jsm-brainwave.com/

It is a very strange bug and I cannot figure it out!

GaijinShacho avatar Mar 26 '24 13:03 GaijinShacho

Had the same problem with Netlify. Just change them to png and they will work! The size keeps small.

xlgabriel avatar Apr 05 '24 02:04 xlgabriel

Had the same problem with Netlify. Just change them to png and they will work! The size keeps small.

How exactly did you do it? Because I changed those images to png and update their source links but its not working.

Shaheer5 avatar Apr 09 '24 08:04 Shaheer5

I used an online service to convert svg to png. Updated the images on the respective folder, and changed the format of the imports from ".svg" to ".png". Did the deploy and that's it. Show me if you get any error during this process

xlgabriel avatar Apr 09 '24 14:04 xlgabriel

Well I did the same but I don't know why its not working for me. https://github.com/Shaheer5/brainwave, it's my repo. Please have a look. Thanks

Shaheer5 avatar Apr 10 '24 07:04 Shaheer5

Well I did the same but I don't know why its not working for me. https://github.com/Shaheer5/brainwave, it's my repo. Please have a look. Thanks

Sorry for the late reply, I've been with a lot of work lately. I've seen your repo and your "card-#" files are still in .svg. I guess the change is still local but just make sure you've successfully changed the format of those files to png. The imports should look like this:

import benefitCard1 from "./benefits/card-1.png"; import benefitCard2 from "./benefits/card-2.png"; import benefitCard3 from "./benefits/card-3.png"; import benefitCard4 from "./benefits/card-4.png"; import benefitCard5 from "./benefits/card-5.png"; import benefitCard6 from "./benefits/card-6.png";

xlgabriel avatar Apr 11 '24 20:04 xlgabriel

Hi, I'm sorry, I've done everything I could think of but its not working, can you look again or can you share repo and live page?

Shaheer5 avatar Apr 12 '24 17:04 Shaheer5

  1. It could be resolved by adding double quotes ("") in ${backgroundUrl} in Benefits.jsx:

style={{ backgroundImage: url("${backgroundUrl}") }}

  1. and importing the benefitCard1 and the rest in constants/index.jsx and replace the backgroundUrl inside the benefits array:

import { benefitCard1, benefitCard2, benefitCard3, benefitCard4, benefitCard5, benefitCard6, } from "../assets";

export const benefits = [ { id: "0", title: "Ask anything", text: "Lets users quickly find answers to their questions without having to search through multiple sources.", backgroundUrl: benefitCard1, iconUrl: benefitIcon1, imageUrl: benefitImage2, },

refer to the documentation : https://vitejs.dev/guide/assets.html

BnS2 avatar Apr 20 '24 09:04 BnS2

Thank you so much, It worked <3.

Shaheer5 avatar Apr 22 '24 04:04 Shaheer5

  1. It could be resolved by adding double quotes ("") in ${backgroundUrl} in Benefits.jsx:

style={{ backgroundImage: url("${backgroundUrl}") }}

  1. and importing the benefitCard1 and the rest in constants/index.jsx and replace the backgroundUrl inside the benefits array:

import { benefitCard1, benefitCard2, benefitCard3, benefitCard4, benefitCard5, benefitCard6, } from "../assets";

export const benefits = [ { id: "0", title: "Ask anything", text: "Lets users quickly find answers to their questions without having to search through multiple sources.", backgroundUrl: benefitCard1, iconUrl: benefitIcon1, imageUrl: benefitImage2, },

refer to the documentation : https://vitejs.dev/guide/assets.html

I was getting error in step-1 and using it like this fix it for me style={{ backgroundImage: url("${backgroundUrl}") }}

Check my deployed webite

22prerak22 avatar Dec 29 '24 22:12 22prerak22