Repository: create-react-app
Issue: Module not found: Error: Can't resolve 'fs' in '/usr/src/app/node_modules/jpeg-exif/lib'
Labels: needs triage

### Describe the bug

When building a react app on production getting Error `Module not found: Error: Can't resolve 'fs' in '/usr/src/app/node_modules/jpeg-exif/lib'`

### Steps to reproduce
 `Node version 18`
1. `npm install --legacy-peer-deps`
2. `npm run build`

package.json file
{
  "name": "dcts-client",
  "version": "0.1.0",
  "private": true,
  "homepage": "ecommerce",
  "dependencies": {
    "@emotion/react": "^11.10.0",
    "@emotion/styled": "^11.10.0",
    "@fortawesome/fontawesome-svg-core": "^6.1.2",
    "@fortawesome/free-brands-svg-icons": "^6.1.2",
    "@fortawesome/free-solid-svg-icons": "^6.1.2",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@hookform/error-message": "^2.0.0",
    "@mui/icons-material": "^5.11.0",
    "@mui/material": "^5.10.2",
    "@mui/x-date-pickers": "^5.0.0",
    "@react-pdf/renderer": "^3.0.1",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^0.27.2",
    "bootstrap": "^5.2.0",
    "card-validator": "^8.1.1",
    "cross-domain-storage": "^2.0.7",
    "dayjs": "^1.11.5",
    "env-cmd": "^10.1.0",
    "js-cookie": "^3.0.1",
    "lodash.isequal": "^4.5.0",
    "payment": "^2.4.6",
    "query-string": "^7.1.1",
    "react": "^18.2.0",
    "react-bootstrap": "^2.5.0",
    "react-confirm-alert": "^3.0.6",
    "react-credit-cards": "^0.8.3",
    "react-csv": "^2.2.2",
    "react-data-table-component": "^7.5.3",
    "react-datepicker": "^4.8.0",
    "react-dom": "^18.2.0",
    "react-hook-form": "^7.36.1",
    "react-input-range": "^1.3.0",
    "react-medium-image-zoom": "^5.0.2",
    "react-phone-input-2": "^2.15.1",
    "react-router-dom": "^6.3.0",
    "react-scripts": "^5.0.1",
    "react-select": "^5.5.9",
    "react-slick": "^0.29.0",
    "react-to-print": "^2.14.8",
    "react-toastify": "^9.0.8",
    "simplebar-react": "^2.4.1",
    "slick-carousel": "^1.8.1",
    "styled-components": "^5.3.6",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "`set PORT=3000 && react-scripts start`",
    "build": "`react-scripts build`",
    "build:production": "`set REACT_APP_API_ENDPOINT_BASE_URL=/api && set REACT_APP_API_ENDPOINT_REDIRECT_URL=http://alb-dct-prd-1561780064.us-east-2.elb.amazonaws.com/ && react-scripts build`",
    "build:testing": "`export REACT_APP_API_ENDPOINT_BASE_URL=/api REACT_APP_API_ENDPOINT_REDIRECT_URL=http://dctalb-1569668697.us-east-2.elb.amazonaws.com/ && react-scripts build`",
    "test": "`react-scripts test`",
    "eject": "`react-scripts eject`"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

### Unexpected behavior

![image](https://github.com/facebook/create-react-app/assets/88545007/3f9c0134-5efa-4913-b41a-4de71e3e1921)