logo The World’s #1 Bootstrap 4 HTML, Angular 10, React, VueJS & Laravel
Admin Dashboard Theme

Deployment

As the example of application URL: https://example.com/my/app.

  1. Setup baseURL via homepage entry in package.json.

    "name": "default",
    "version": "0.1.0",
    "private": true,
    - "homepage": "https://keenthemes.com/metronic/preview/react"
    + "homepage": "https://example.com/my/app",
    "scripts": {
  2. Setup correct destinations and source in serve.json.

    "redirects": [{
      "source": "/",
      - "destination": "/metronic/preview/react",
      + "destination": "/my/app",
    }],
    "rewrites": [{
      - "source": "/metronic/preview/react/**",
      + "source": "/my/app/**",
      - "destination": "/metronic/preview/react/index.html"
      + "destination": "/my/app/index.html"
    }]
  3. Run build.

    yarn build

Serve production mode

As the example of application URL: http://localhost:5000.

  1. Setup baseURL via homepage entry in package.json.

    "name": "default",
        "version": "0.1.0",
        "private": true,
        - "homepage": "https://keenthemes.com/metronic/preview/react"
        + "homepage": "https://localhost:5000",
        "scripts": {
  2. Setup correct destinations and source in serve.json.

    "redirects": [{
          "source": "/",
          - "destination": "/metronic/preview/react",
          + "destination": "",
        }],
        "rewrites": [{
          - "source": "/metronic/preview/react/**",
          + "source": "/**",
          - "destination": "/metronic/preview/react/index.html"
          + "destination": "/index.html"
        }]
  3. Run build.

    yarn build
  4. For environments using Node, the easiest way to handle this would be to install serve and let it handle the rest:

    Run npm install -g serve and serve -s build -l 5000

  5. Open http://localhost:5000 URL in your browser

Host react application on Apache server setup: CRA Apache setup

Our Metronic React application is based on Create React App. For more detailed information of the CRA, visit the official Create React App documentation website.