I'm building a little tool to create a source code file.
The tool iterates through a directory, gets all *.js files and reads them all to an array.
For example React (https://unpkg.com/react@18/umd/react.production.min.js).
Reading File > save to variable
Write variable to file > e.g. `const myVariable = `${fileContent}`;`
This alone obviously doesn't work. I have to replace line breaks etc.
e.g:
content.replace(/(?:\r\n|\r|\n)/g, "");
And that's the problem. Replacing special characters results in unexpected behavior (syntax errors of the final JavaScript).