I made the project using Intelij
Your IDE isn’t really relevant (unless you are using some sort of built-in web server that comes with it: if you are you should make that explicit in the question).
Why is this happening
Something is wrong with your HTTP server. You haven’t said what server you are using (or provided the code for it if you’ve written it yourself).
Why is this happening even thought I put type=”text/javascript inside the script tag?
The type
attribute (when given a MIME type, the module
value is a special case) tells the browser what to expect to get in the response to a request for the script’s URL. This lets the browser avoid requesting scripts in programming languages it doesn’t understand. The HTTP response headers are still authorative.