Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.
erver {
server_name marsworld.co.in www.marsworld.co.in;
root /var/www/marsworld.co.in/html/admin;
listen [::]:443 ssl ipv6only=on;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/marsworld.co.in/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/marsworld.co.in/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
# Main location for the admin app
location / {
#alias /var/www/marsworld.co.in/html/admin/;
#try_files $uri $uri/ /admin/index.html;
try_files $uri $uri/ /index.html =404;
}
location /v1/ {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
#location / {
# try_files $uri $uri/ =404;
}
}
my node backend works correctly i clone react app from git and build using vite i.e. npm run build then i put all the content of my build/* to /var/www/marsworld.co.in/html/admni/
then i reload nginx but on browser i got
index-Bohx2IxF.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.