1

i am using webpack 5.64.1 in react application . after i run command "npm run build". i get build folder in my project. i uploaded all files from build folder to /usr/share/nginx/html/

here is my nginx configuration file

server {
    listen       80;

    listen 443 ssl;

    server_name *********;
    
    ssl_certificate /etc/ssl/certs/fullchain.pem;
    ssl_certificate_key /etc/ssl/certs/privkey.pem;

    root   /usr/share/nginx/html;
    index  index.html index.htm;
    
    location / {

        try_files $uri /index.html;

    }
    
    access_log /var/log/nginx/*****-access.log;
    error_log /var/log/nginx/******.com-error.log;
}

when i access my website using browser it generates following error in console

1-Uncaught SyntaxError: Unexpected token '<' for file main.***.js 2-Manifest: Line: 1, column: 1, Syntax error. in c22d0795e9e5a7e609fc.json file

after inspecting it it network tab i have come to realize that preview for these files are not available. though these are returning 200 status code.

Thank you in advance

Dipten
  • 1,031
  • 8
  • 16

1 Answers1

0

Have you created manifest.json file under public/ folder first ?

This is sample manifest.json

{
  "short_name": "React App",
  "name": "Create React App Sample",
  "icons": [
    {
      "src": "favicon.ico",
      "sizes": "64x64 32x32 24x24 16x16",
      "type": "image/x-icon"
    },
  ],
  "start_url": ".",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff"
}