Repository: create-react-app
Issue: On Updating to react scripts 5, the build is successfull on local, but on the pipeline we get error saying "Cannot find module @bable/polyfill "
Labels: needs triage,issue: bug report

<!--

-->

### Describe the bug

On upgrading to react scripts 5, 
Build fails : Cannot find module @bable/polyfill
Also some of the snapshot sizes for the test cases increase.

### Did you try recovering your dependencies?



  If you decided to use npm, run this in your project directory:

 

  Have you done all these steps and still see the issue?
  Please paste the output of `npm --version` and/or `yarn --version` to confirm.
-->

npm -> 8.1.3
node -> 14.17.3

(

### Which terms did you search for in User Guide?

<!--
  There are a few common documented problems, such as watcher not detecting changes, or build failing.
  They are described in the Troubleshooting section of the User Guide:

  https://facebook.github.io/create-react-app/docs/troubleshooting

  Please scan these few sections for common problems.
  Additionally, you can search the User Guide itself for something you're having issues with:

  https://facebook.github.io/create-react-app/

  If you didn't find the solution, please share which words you searched for.
  This helps us improve documentation for future readers who might encounter the same problem.
-->

(Write your answer here if relevant.)

### Environment

<!--
  To help identify if a problem is specific to a platform, browser, or module version, information about your environment is required.
  This enables the maintainers quickly reproduce the issue and give feedback.

  Run the following command in your React app's folder in terminal.
  Note: The result is copied to your clipboard directly.

  `npx create-react-app --info`

  Paste the output of the command in the section below.
-->


  System:
    OS: macOS 13.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 16.13.1 - ~/Documents/Work/Insights/ui-channel-perf/node_modules/.bin/node
    Yarn: Not Found
    npm: 8.1.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 114.0.5735.133
    Edge: Not Found
    Firefox: 113.0.1
    Safari: 16.5
  npmPackages:
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 
    react-scripts: 4.0.3 => 4.0.3 (3.4.4)

Package.json :

{
  "name": "xyz",
  "version": "0.1.522",
  "dependencies": {
    "@amcharts/amcharts4": "^4.10.22",
    "@deck.gl/mesh-layers": "^8.6.8",
    "@emotion/react": "^11.7.1",
    "@material-ui/core": "^4.12.3",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.60",
    "@mui/icons-material": "^5.1.1",
    "@mui/material": "^5.1.1",
    "@mui/styled-engine-sc": "^5.1.0",
    "@mui/styles": "^5.1.1",
    "@reactour/tour": "^2.9.0",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.1.10",
    "ansi-html": "0.0.9",
    "ansi-regex": "6.0.1",
    "async": "3.2.2",
    "axios": "^0.24.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "classnames": "^2.3.1",
    "dayjs": "^1.10.7",
    "decode-uri-component": "0.2.2",
    "dotenv-flow": "^3.2.0",
    "ejs": "3.1.7",
    "express": "^4.17.1",
    "ignore-styles": "^5.0.1",
    "jest-fetch-mock": "^3.0.3",
    "jsonwebtoken": "^9.0.0",
    "loader-utils": "2.0.3",
    "lodash": "^4.17.21",
    "lodash.debounce": "^4.0.8",
    "md5-file": "^5.0.0",
    "moment": "^2.29.4",
    "mui-datatables": "^4.0.0",
    "node": "^16.13.1",
    "node-forge": "1.3.0",
    "node-polyfill-webpack-plugin": "^2.0.1",
    "nth-check": "2.0.1",
    "qs": "6.10.3",
    "react": "^17.0.2",
    "react-data-export": "^0.6.0",
    "react-dom": "^17.0.2",
    "react-redux": "^7.2.6",
    "react-router-dom": "5.2.0",
    "react-scripts": "^5.0.1",
    "react-select": "^5.4.0",
    "redux": "^4.1.2",
    "redux-mock-store": "^1.5.4",
    "redux-saga": "^1.1.3",
    "styled-components": "^5.3.3",
    "timezone-mock": "^1.3.6",
    "tmpl": "1.0.5",
    "unset-value": "2.0.1",
    "url-parse": "1.5.9",
    "web-vitals": "^1.0.1",
    "xlsx": "0.17.0",
    "ag-grid-community": "^29.3.4",
    "ag-grid-enterprise": "^29.3.4",
    "ag-grid-react": "^29.3.5",
    "react-joyride": "^2.5.4",
    "react-use": "^17.4.0",
    "react-app-rewired": "^2.2.1"
  },
  "scripts": {
    "start:local": "react-app-rewired start",
    "start": "REACT_APP_ENV_HOST=$REACT_APP_ENV_HOST node --max-http-header-size 16384 build/server",
    "build": "REACT_APP_ENV_HOST=$REACT_APP_ENV_HOST react-app-rewired build && cp -R ./server/* ./build && npm run moveFiles",
    "test": "react-scripts test",
    "test:coverage": "react-scripts test --coverage --watchAll=false",
    "eject": "react-scripts eject",
    "moveFiles": "cd build && mkdir channelperformance && cp -r ./static ./channelperformance/static",
    "storybook": "start-storybook -p 6006 -s public",
    "build-storybook": "build-storybook -s public",
    "test:update": "react-scripts test -u"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ],
    "overrides": [
      {
        "files": [
          "**/*.stories.*"
        ],
        "rules": {
          "import/no-anonymous-default-export": "off"
        }
      }
    ]
  },
  "jest": {
    "collectCoverageFrom": [
      "src/**/*.{js,jsx}",
      "!/node_modules/",
      "!src/coverage/**",
      "!src/index.js",
      "!src/stories/**"
    ],
    "coveragePathIgnorePatterns": [
      "/src/constants",
      "/src/routes",
      "/src/helper",
      "/src/reportWebVitals.js",
      "/src/components/Drilldown/DownloadMuiTable",
      "/src/components/Drilldown/ReactVirtualized",
      "/src/components/Drilldown/Common/ChannelBreakdown.js"
    ],
    "transformIgnorePatterns": [
      "[/\\\\]node_modules[/\\\\](?!(@amcharts)\\/).+\\.js$"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "resolutions": {
    "babel-eslint": "^10.0.0"
  },
  "devDependencies": {
    "@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
    "babel-jest-amcharts": "^0.0.2",
    "enzyme": "^3.11.0",
    "enzyme-to-json": "^3.4.4",
    "eslint": "^7.28.0",
    "prettier": "2.3.1",
    "redux-devtools-extension": "^2.13.9"
  }
}