DEV Community

Discussion on: Create Express Server with ejs templating Engine

lexiebkm profile image
Alexander B.K. • Edited

I have trouble in using external javascript file when using either EJS or Pug. The problem is the external js file sent by the server is always loaded with MIME type of "text/html" by the browser, eventhough I have used the correct MIME type : "text/javascript".
As mentioned in some sources, even without explicit type, the script has a default MIME type of "text/javascript". But browser still loads the script with MIME type of "text/html".
How to overcome this problem ?