My project is React.js/Babel.js based. I have no errors with my code which I'm certain of, but the live server isn't responding to changes made via JavaScript. I made changes to the HTML file, changes take place without any errors. When I make changes to the JavaScript file, they don't.
I tried the following options but the problem remained as is and the browser refuse to show changes on the code:
Here's a Screenshot:
Then I tried running Live Server for the public directory [live-server public] and that showed me the following console result:
Stackoverflow keeps showing this error [Your post appears to contain code that is not properly formatted as code.] therefore I uploaded my code to Codepen [https://codepen.io/abbbas_alhashimi/pen/XWzQaJP]
Please note: There is a console message that isn't displayed in the browser when live-server is running "test". I tried changing string values as well, but the browser keeps showing the old version of the code.
I hope, I have given you all the information required to help me solve this issue.
Thank you in advance
I solved it!
You Need to make sure that Babel Presets are properly installed and compiling JSX with Babel into JavaScript. You could use the following script to clarify the requested compilation files, the output, and the presets. babel src/app.js --out-file=public/scripts/app.js --presets=env,react
. Once the server is running and compiling, you should let the server actively compile JSX and all your changes will take place without any further complications. This can be done by adding --watch at the end of the last command to look like this: babel src/app.js --out-file=public/scripts/app.js --presets=env,react --watch
.
I hope my someone will find my solution helpful.