#import .tsx file from public folder
20 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>
✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
(if you don't see the option, try refreshing Discord with Ctrl + R)
is this the actual import path? any string starting / will point to the root of you filesystem, which is probably completely outside your project folder, so this will never compile
and for the question itself, I think the bundling does work with files from the public folder but it doesn't really make sense to add source code there unless you want people to see all your code
It's not really source code. that are 3 <SVG> elements that I'm exporting and together they're forming the Website icon.
And as I understand from the docs (https://nextjs.org/docs/app/building-your-application/optimizing/static-assets)
/ should point to the public folder
.tsx is source code, SVG files should use the .svg extension if you plan to serve them and use in the HTML tags. the link you shared shows a string as the path of an image tag, which is a different path type from imports and follows a different logic:
- file imports at the top of the file represent paths on the filesystem
- the path on src props represent an address to a resource being served from a web server
Yeah for sure it's source code but not in the classic sense 😄
I'm using it that way so I can have the logo in one file, but separate it in the 3 components, because I need to animate just parts of it.
So I don't need to protect it, I even want people to be able to access it.
Ahhh. That makes sense. Thanks a lot
But how would I access the public folder in an import?
@public probably hm?
@ starts at /src (if any) or at / (if not using src folder) so i think just use ../../.. untill you arrive at the public folder
o nice
you may want to check if you imported as default or normal
then try to check tsconfig.json, you will find the alias there
nvm, i didn't see this