React site is displaying JS source code instead of executing

https://eclectic-llama-99da51.netlify.app/src/app.js

This is a test of a react site. When you go to that URL the JS file just shows the source of it instead of executing. Is there something else needed to get it working?

@spudMan This seems to be a pretty fundamental misunderstanding of how JavaScript works in a browser.

If you directly access any JavaScript file on the internet it will just appear as plain text in your browser.

For example pressing “view source” on this exact page, and going to one of the scripts running this forum:
https://global.discourse-cdn.com/netlify/assets/start-discourse-7c0f5f4daf3c942b7b6ecfe8e62e2e5a0f6555924859cf055314c0df3d617353.br.js

You will need a html file, with a <script> tag, see:

Or:

1 Like