#Image
55 messages · Page 1 of 1 (latest)
the @ alias only works if you defined it in your config (IE vite.config.js or webpack.config.js)
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
}
also, if the code file containing the import, so this line of code, is in src, i suggest changing the path to ./assets/images/logo.svg
replace @ with .
but it depends on where your code file is
tell me if it works
it does apeaar when i rrun the build but in dev env its not apearing
That means that the @ alias is not recognised probably
Do you have a config.js file?
did you try changing the @ to a .
the images wont apear even if i replace @ with .. or .
ah
can you give me the path of the code file that contains the line of your import?
just a screenshot is fine
is it in src?
try moving the logo.svg into src, and replace your code with
import logoImage from "./logo.svg";
This only works if both the logo.svg and the code file containing this import are in the same folder (IE src)
the logo.svg is in src/asserts/images
can you send me a screenshot of your entire files please, so i can see src folder and i can see the logo.svg location
does this work?
yes but you can send it in vscode? So i can see everything. Also I want to see the src folder pls
AL
like this you know
alr wait
so i can see logo.svg, and the file you are using to import it
oh bro it's normal
your nvbar is not inside src, which is not a bad thing
but that means that you have to change the code to
import logoImage from '../assets/images/logo.svg';
should work now
i did tht still no logo 
huh
well, see now the import path is not highlighted with a red line right?
if it is not red under the code, that means that the path is correct
so this is fixed
but maybe there is another issue
you did save the file before running the npm dev?
yeah
well since the issue is not in the import, maybe it is in the code of Navbar.tsx. Can you send me your code maybe with gist?
You can put the entire Navbar.tsx in there
then just press the green button and give me the link, i will check it out
I see, you are using nextjs
remove this line
import logoImage from "../assets/images/logo.svg";
and now find this
<Image
src={logoImage}
alt="Site Logo"
className="h-9 md:h-auto w-auto"
/>
And replace this whole block of code with:
<img
src="/assets/images/logo.svg"
alt="Site Logo"
className="h-9 md:h-auto w-auto"
/>
And it should work. Tell me if it does
nnah doset work 
so, your logo image is in
src/assets/images/logo.svg
so for it to work, you need to move it inside
public/assets/images/logo.svg
see that public folder in vscode? Well, you do whatever you want but I think it is best practice to put assets there because they can be referenced by default in code.
If you keep yout images inside src/assets/images it will be harder because you will need to import them as a react component using @svgr so extra config
basically, put your logo inside public/assets/images/logo.svg and it should work.