A JS file produced for download looked completely correct when read back in the same tool, but failed with a syntax error the moment it was actually loaded as a script on the page. The file’s line breaks had been written as the literal two-character sequence n rather than real newline bytes.
⚡ Quick Fix (TL;DR)
The Culprit: Whatever generated the file wrote an escaped n string instead of an actual line-feed character — something that can look identical in a text preview but isn't.
The Fix: Confirmed with a syntax check (node -c) before trusting any generated code file is good to ship, then rewrote the file with real line breaks. Worth remembering: a file "looking right" in a chat window or preview pane doesn't guarantee its actual bytes are right — run a real syntax check on anything that will be executed.
Rather not untangle this yourself? Our Done-For-You team handles exactly this kind of thing, start to finish.
See DFY options → Was this helpful? Thanks for the feedback!
Tagged in :