Next.js Discord

Discord Forum

<Script/> tag not working at all

Unanswered
Yellowhead catfish posted this in #help-forum
Open in Discord
Yellowhead catfishOP
Nothing is being printed in the console.
index.js is literally just console.log("hi");

21 Replies

Yellowhead catfishOP
bump
@Yellowhead catfish bump
Knopper gall
Could you try with a closing tag?
Yellowhead catfishOP
what do you mean?
Knopper gall
I remember in my early programming days there was janky behaviour with <script /> over <script><script/>
Yellowhead catfishOP
as in <Script></Script>
Knopper gall
yea
Yellowhead catfishOP
well its not script its Script, even the docs tell me to use it this way
Knopper gall
I know that, it was just a suggestion
Yellowhead catfishOP
welp
using <script/> fixed it (not next.js component)
Knopper gall
the other thing I find odd is that you're using absolute pathing /path/to/script.js as opposed to script.js
shouldn't be a major issue but just a thought
"This can be either an absolute external URL or an internal path."
@Knopper gall the other thing I find odd is that you're using absolute pathing `/path/to/script.js` as opposed to `script.js`
Yellowhead catfishOP
well im pretty sure it takes the files from the public directory, and inside of that public directory i have a folder called javascript and inside that i have the index.js
@Yellowhead catfish well im pretty sure it takes the files from the public directory, and inside of that public directory i have a folder called javascript and inside that i have the index.js
Knopper gall
Well considering you want to refer to the docs, the docs say absoluting pathing must be external
So you should change it to javascript/index.js
Yellowhead catfishOP
hmm alright
funniest thing is, this is the code from a friend
im running the IDENTICAL code to him, with the / in front of javascript and it runs fine on my end, but on his end it doesnt work at all lol
Knopper gall
Well you're both clearly doing something differently that's causing the discrepancy 😛

lmk if it works with relative internal pathing