#Importing local custom scripts
11 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)
put the script in the public folder
it's a must?
cause I were more comfortable to put it in the same folder of the components it's related to
<Script /> is for external scripts, which mean you either (1) specify a URL pointing to that script or (2) use the entire script content as a string.
public folder is an easy way to do (1).
if you want to keep in the same folder, you need to get either the file content or the file URL when importing the script file, which means you need to write a custom webpack config to handle module resolution for this specific script file. so while it's technically doable, do you think it's worth it?
oh, okay
thank you very muchj
anyway, do you have some suggestions about folder management?
not much, no. this is all what you need to know https://nextjs.org/docs/app/building-your-application/routing/colocation
after all this is your project. there is no right or wrong. there is only what works for you and what doesn't. i change my folder structure once in a while too.
This question has been marked as answered! If you have any other questions, feel free to create another post
[Click here](#1299680883925712896 message)