React脚本问题:循环加载chunk.js

时间:2019-07-08 13:41:23

标签: javascript reactjs webpack

我正在使用React脚本v3。每当我在页面中执行操作(鼠标事件,表单...)时,都会遇到此问题,应用程序会继续下载 chunk.js

enter image description here

这是我的 package.json

{
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "babel-polyfill": "^6.26.0",
    "bootstrap": "^4.3.1",
    "cors": "^2.8.5",
    "lodash.flatten": "^4.4.0",
    "lodash.get": "^4.4.2",
    "lodash.intersection": "^4.4.0",
    "mockdate": "^2.0.2",
    "moment": "^2.24.0",
    "prop-types": "^15.7.2",
    "react": "^16.8.6",
    "react-app-polyfill": "^1.0.1",
    "react-dom": "^16.8.6",
    "react-router": "4.3.1",
    "react-router-dom": "4.3.1",
    "react-scripts": "^3.0.1",
    "recompose": "^0.30.0",
    "url-search-params-polyfill": "^6.0.0",
    "uuid": "^3.3.2"
  },
  "scripts": {
    "mocks": "cd mocks && npm start",
    "start-dotnet": "react-scripts start",
    "start": "concurrently \"npm run mocks\" \"react-scripts start\"",
    "build": "react-scripts build",
    "test": "set NODE_ICU_DATA=node_modules/full-icu&& react-scripts test --env=jsdom",
    "test:staged": "npm run test -- --coverage --findRelatedTests --watchAll=false",
    "test-coverage": "npm run test -- --coverage --watchAll=false"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged",
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  "lint-staged": {
    "*src/**/*.js": [
      "prettier --write",
      "npm run test:coverage",
      "git add"
    ]
  },
  "commitlint": {
    "extends": [
      "@commitlint/config-conventional"
    ]
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "jest": {
    "snapshotSerializers": [
      "enzyme-to-json/serializer"
    ]
  },
  "browserslist": [
    ">0.2%",
    "ie 11",
    "not dead",
    "not op_mini all"
  ],
  "devDependencies": {
    "@commitlint/cli": "^8.0.0",
    "@commitlint/config-conventional": "^8.0.0",
    "concurrently": "^4.1.0",
    "enzyme": "^3.9.0",
    "enzyme-adapter-react-16": "^1.12.1",
    "enzyme-to-json": "^3.3.5",
    "eslint-plugin-react-hooks": "^1.6.0",
    "full-icu": "^1.3.0",
    "husky": "^2.4.1",
    "jest": "^24.7.1",
    "jest-cucumber": "^2.0.11",
    "lint-staged": "^8.2.1",
    "node-sass": "^4.11.0",
    "prettier": "^1.18.2"
  }
}

有人对这个问题有想法吗?

2 个答案:

答案 0 :(得分:0)

我今天遇到了这个问题。我将onChange操作错误地设置为字符串而不是函数,因此将其更改为对我有用的函数。

答案 1 :(得分:0)

我遇到了同样的问题,它一直在请求块。 发生这种情况是因为我的 JS 块中有一个参考问题,我懒加载。 所以我懒惰地加载页面数据,为此在 JS 中,我正在导入一个不存在的文件。这导致了这个问题。

修复它为我修复了它。