Tammy
Tammy

Reputation: 1132

How to remove Create react app sample in production

I have a domain which is successfully deployed in production server. But whenever I open it one Install app: Create React app sample is showing in address bar.

Is there any way to remove this. What should i change in my code? Any suggestion here?

//Client package.json

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.19.2",
    "bootstrap": "^4.4.1",
    "bootstrap-less": "^3.3.8",
    "moment": "^2.24.0",
    "node-sass": "^4.13.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "redux-thunk": "^2.3.0",
    "uuid": "^7.0.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
    ],
    "development": [
      "last 1 chrome version",
    ]
  },
  "proxy": "http://localhost:5000"
}

//manifest.json

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

enter image description here

Upvotes: 4

Views: 6387

Answers (2)

UniversE
UniversE

Reputation: 575

If you just want to temporarily hide that icon, you can comment out the line that looks like <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> in your-project-root/public/index.html, don’t need to remove or modify manifest.json.

Upvotes: 3

Gulam Hussain
Gulam Hussain

Reputation: 1763

You need to change manifest.json file, you might find it in public folder which is created by create-react-app.

manifest.json file is used by serviceWorker to let user install your webapp as a app, you can skip short_name property, but you should provide a proper name. but skipping both won't casue any problem in functionality of the app, in this case browser will use default name (i.e. untitled) for your app.

In my suggestion, you should provide both short_name and name property.

In there

{
  "short_name": "React App",
  "name": "Create React App Sample", // you need to change this
  "icons": [
    {
      "src": "favicon.ico",
      "sizes": "192x192",
      "type": "image/png"
    }
  ],
  "start_url": "./index.html",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff"
}

Upvotes: 9

Related Questions