You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ReactJS项目webpack <5 Node.js polyfill缺失问题求助(react-app-rewired无效)

React应用react-app-rewired配置问题求助

我已经查遍StackOverflow所有类似问题及其他资料,仍无法解决当前问题。我的ReactJS应用出现截图中的错误提示,虽使用react-app-rewired,但将config-overrides文件放在根目录的所有解决方案均无效。目前我的config-overrides.js位于node_modules/react-app-rewired文件夹中,以下是相关配置文件内容及截图:

config-overrides.js

const {paths} = require('./');
// load environment variables from .env files
// before overrides scripts are read
require(paths.scriptVersion + '/config/env');
const override = require(paths.configOverrides);

const webpack = typeof override === 'function'
  ? override
  : override.webpack || ((config, env) => config);

if (override.devserver) {
  console.log(
    'Warning: `devserver` has been deprecated. Please use `devServer` instead as ' +
    '`devserver` will not be used in the next major release.'
  )
}

const devServer = override.devServer || override.devserver
  || ((configFunction) =>
    (proxy, allowedHost) =>
      configFunction(proxy, allowedHost));

const jest = override.jest || ((config) => config);

const pathsOverride = override.paths || ((paths, env) => paths);

// normalized overrides functions
module.exports = {
  webpack,
  devServer,
  jest,
  paths: pathsOverride
};

package.json

{    "name": "fuse-react-app",
    "version": "8.2.1",
    "private": true,
    "dependencies": {
        "@date-io/date-fns-jalali": "2.15.0",
        "@emotion/cache": "11.9.3",
        "@emotion/react": "11.9.3",
        "@emotion/styled": "11.9.3",
        "@fullcalendar/daygrid": "5.11.2",
        "@fullcalendar/interaction": "5.11.2",
        "@fullcalendar/react": "5.11.2",
        "@fullcalendar/timegrid": "5.11.2",
        "@googleapis/docs": "^1.0.1",
        "@hookform/resolvers": "2.9.7",
        "@mui/base": "5.0.0-alpha.93",
        "@mui/icons-material": "5.8.4",
        "@mui/lab": "5.0.0-alpha.95",
        "@mui/material": "5.10.1",
        "@mui/styles": "5.9.3",
        "@mui/system": "5.10.1",
        "@mui/utils": "5.9.3",
        "@mui/x-data-grid": "5.15.2",
        "@mui/x-date-pickers": "5.0.0-beta.6",
        "@react-pdf/renderer": "^3.0.0",
        "@reduxjs/toolkit": "1.8.5",
        "apexcharts": "3.35.4",
        "autosuggest-highlight": "3.3.4",
        "axios": "0.27.2",
        "axios-mock-adapter": "1.21.2",
        "browserify-zlib": "^0.2.0",
        "clsx": "1.2.1",
        "core-js": "3.24.1",
        "crypto-js": "4.1.1",
        "date-fns": "2.29.1",
        "date-fns-jalali": "2.21.3-1",
        "draft-js": "0.11.7",
        "draftjs-to-html": "0.9.1",
        "firebase": "^9.10.0",
        "framer-motion": "7.2.0",
        "fs": "^0.0.1-security",
        "google-map-react": "2.2.0",
        "googleapis": "^108.0.0",
        "history": "5.3.0",
        "i18next": "21.9.1",
        "jwt-decode": "3.1.2",
        "keycode": "2.2.1",
        "lodash": "4.17.21",
        "marked": "4.0.18",
        "material-ui-popup-state": "2.0.1",
        "mobile-detect": "1.4.5",
        "mobx": "^6.6.1",
        "moment": "2.29.4",
        "net": "^1.0.2",
        "notistack": "1.0.6-next.3",
        "os": "^0.1.2",
        "perfect-scrollbar": "1.5.5",
        "prismjs": "1.28.0",
        "prop-types": "15.8.1",
        "qs": "6.11.0",
        "raw-loader": "4.0.2",
        "react": "18.2.0",
        "react-apexcharts": "1.4.0",
        "react-autosuggest": "10.1.0",
        "react-beautiful-dnd": "13.1.0",
        "react-dom": "18.2.0",
        "react-draft-wysiwyg": "1.15.0",
        "react-draggable": "4.4.5",
        "react-hook-form": "7.34.2",
        "react-i18next": "11.18.4",
        "react-imask": "6.4.2",
        "react-masonry-css": "1.0.16",
        "react-number-format": "4.9.3",
        "react-pdf": "^5.7.2",
        "react-popper": "2.3.0",
        "react-redux": "8.0.2",
        "react-router-dom": "6.3.0",
        "react-spring": "8.0.27",
        "react-swipeable": "7.0.0",
        "react-swipeable-views": "0.14.0",
        "react-swipeable-views-utils": "0.14.0",
        "react-table": "7.8.0",
        "react-transition-group": "4.4.5",
        "react-virtualized": "9.22.3",
        "react-window": "1.8.7",
        "redoc": "2.0.0-rc.76",
        "redux-logger": "4.0.0",
        "stream": "^0.0.2",
        "styled-components": "5.3.5",
        "stylis": "4.1.1",
        "stylis-plugin-rtl": "2.1.1",
        "tls": "^0.0.1",
        "tools": "^0.0.0",
        "web-vitals": "2.1.4",
        "yup": "0.32.11",
        "zlib": "^1.0.5"
    },
    "peerDependencies": {
        "autoprefixer": "10.4.7",
        "postcss": "8.4.13",
        "react": "18.2.0",
        "react-dom": "18.2.0"
    },
    "resolutions": {
        "react": "18.2.0",
        "react-dom": "18.2.0",
        "babel-loader": "8.1.0"
    },
    "devDependencies": {
        "@babel/core": "7.17.10",
        "@babel/eslint-parser": "7.17.0",
        "@babel/node": "7.17.10",
        "@babel/preset-env": "7.17.10",
        "@babel/preset-react": "7.16.7",
        "@tailwindcss/aspect-ratio": "^0.4.0",
        "@tailwindcss/line-clamp": "^0.4.0",
        "@tailwindcss/typography": "^0.5.4",
        "@typescript-eslint/eslint-plugin": "^4.33.0",
        "@typescript-eslint/parser": "^4.33.0",
        "assert": "^2.0.0",
        "autoprefixer": "9.8.8",
        "buffer": "^6.0.3",
        "cross-env": "7.0.3",
        "crypto-browserify": "^3.12.0",
        "eslint": "7.32.0",
        "eslint-config-airbnb": "^18.2.1",
        "eslint-config-prettier": "^8.3.0",
        "eslint-config-react-app": "^6.0.0",
        "eslint-plugin-flowtype": "^5.10.0",
        "eslint-plugin-import": "^2.25.2",
        "eslint-plugin-jsx-a11y": "^6.4.1",
        "eslint-plugin-prettier": "^4.0.0",
        "eslint-plugin-react": "^7.26.1",
        "eslint-plugin-react-hooks": "^4.2.0",
        "eslint-plugin-unused-imports": "^1.1.5",
        "https-browserify": "^1.0.0",
        "immutable": "4.0.0",
        "js-beautify": "1.14.0",
        "os-browserify": "^0.3.0",
        "postcss": "8.4.5",
        "prettier": "^2.4.1",
        "process": "^0.11.10",
        "promise": "8.1.0",
        "react-app-alias": "2.2.0",
        "react-app-rewired": "^2.2.1",
        "react-scripts": "5.0.1",
        "source-map-explorer": "2.5.2",
        "stream-browserify": "^3.0.0",
        "stream-http": "^3.2.0",
        "tailwindcss": "3.1.8",
        "typescript": "4.6.4",
        "url": "^0.11.0",
        "util": "^0.12.5"
    },
    "scripts": {
        "start": "react-app-rewired start",
        "build": "cross-env GENERATE_SOURCEMAP=false react-app-rewired build",
        "test": "react-app-rewired test --env=node",
        "eject": "react-app-rewired eject",
        "build-docs": "babel-node --presets @babel/preset-env src/app/main/documentation/material-ui-components/build.js",
        "analyze": "react-app-rewired build && source-map-explorer 'build/static/js/*.js' --html analyze-result.html",
        "lint": "eslint"
    },
    "engines": {
        "node": ">=14.0.0",
        "npm": ">=7.0.0"
    },
    "browserslist": {
        "production": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ],
        "development": [
            "last 1 chrome version",
            "last 1 firefox version",
            "last 3 safari version"
        ]
    }
}

错误提示截图
项目根目录文件截图

内容的提问来源于stack exchange,提问作者Emo Flore

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 08:15:35