Current Behavior: When trying to load JavaScript files from the project directory, the files are being blocked due to an incorrect MIME type (text/html instead of application/javascript ). This results in the following errors:
Loading module from “https://sorting-visualization-gtpts2g0b-matadamczyks-projects.vercel.app/public/js/auth/checkAuth.js” was blocked because of a disallowed MIME type (“text/html”).Loading failed for the module with source “https://sorting-visualization-gtpts2g0b-matadamczyks-projects.vercel.app/public/js/auth/checkAuth.js”.Loading module from “https://sorting-visualization-gtpts2g0b-matadamczyks-projects.vercel.app/public/js/app.js” was blocked because of a disallowed MIME type (“text/html”).Loading failed for the module with source “https://sorting-visualization-gtpts2g0b-matadamczyks-projects.vercel.app/public/js/app.js”.
**Expected Behavior:** JavaScript files should load correctly with the MIME type `application/javascript` .
<!-- Code, configuration, and steps that reproduce this issue -->
Here is the vercel.json configuration:
{ "version": 2, "builds": [ { "src": "server/**", "use": "@vercel/node" }, { "src": "public/**", "use": "@vercel/static" }, { "src": "views/**", "use": "@vercel/static" } ], "routes": [ { "src": "/api/(.*)", "dest": "/api/$1" }, { "src": "/auth/(.*)", "dest": "js/auth/$1" }, { "src": "/js/(.*)", "headers": { "Content-Type": "application/javascript" }, "dest": "/public/js/$1" }, { "src": "public/js/(.*)", "headers": { "Content-Type": "application/javascript" }, "dest": "/public/js/$1" }, { "src": "/js/visualization.js", "headers": { "Content-Type": "application/javascript" }, "dest": "/public/js/visualization.js" }, { "src": "/js/app.js", "headers": { "Content-Type": "application/javascript" }, "dest": "/public/js/app.js" }, { "src": "/js/auth/checkAuth.js", "headers": { "Content-Type": "application/javascript" }, "dest": "/public/js/auth/checkAuth.js" }, { "src": "/public/css/(.*)", "headers": { "Content-Type": "text/css" }, "dest": "/public/css/$1" }, { "src": "/about", "dest": "/views/about.html" }, { "src": "/profile", "dest": "/views/profile.html" }, { "src": "/(.*)", "dest": "/views/index.html" } ]}- Project URL: https://sorting-visualization-gtpts2g0b-matadamczyks-projects.vercel.app/
- Framework: Node.js, Static files
- Environment: Vercel deployment