简体   繁体   English

ReactJS 随机意外的令牌'<'

[英]ReactJS randomly Unexpected token '<'

Project was created with create-react-app.项目是使用 create-react-app 创建的。 Did not eject.没有弹出。 There are no webpack configs.没有 webpack 配置。 Default "react-scripts": "^3.4.0" .默认"react-scripts": "^3.4.0" On dev version there is no error.dev版本上没有错误。 But on production when user stays long on one page and clicks the link it shows white page, and after updating the site(deploying new version).但是在生产中,当用户长时间停留在一个页面上并单击链接时,它会显示白页,并且在更新站点(部署新版本)之后。 This error randomly appears.这个错误是随机出现的。 Output on console控制台输出

Unexpected token '<'意外标记“<”

and no other information.并且没有其他信息。

There is my package.json有我的package.json

{
  "name": "project-name",
  "version": "2.0.0",
  "description": "description",
  "private": true,
  "dependencies": {
    "@bugsnag/js": "^6.5.0",
    "@bugsnag/plugin-react": "^6.5.0",
    "@glidejs/glide": "^3.4.1",
    "@material-ui/core": "^4.4.1",
    "@sentry/browser": "^5.11.2",
    "@sentry/cli": "^1.49.0",
    "@types/jest": "^25.1.3",
    "@types/node": "^13.7.4",
    "@types/rc-switch": "^1.9.0",
    "@types/react": "^16.9.22",
    "@types/react-dom": "^16.9.5",
    "axios": "^0.19.0",
    "chart.js": "^2.9.1",
    "classnames": "2.2.6",
    "debounce-promise": "^3.1.2",
    "formik": "^1.5.8",
    "jquery": "^3.4.1",
    "logrocket": "^1.0.6",
    "logrocket-react": "^4.0.1",
    "moment": "2.24.0",
    "moment-timezone": "^0.5.27",
    "orgchart": "^2.1.5",
    "prop-types": "^15.7.2",
    "purgecss": "^1.4.0",
    "rc-switch": "^1.9.0",
    "react": "^16.9.0",
    "react-autosuggest": "^9.4.3",
    "react-chartjs-2": "^2.7.6",
    "react-circular-progressbar": "^2.0.2",
    "react-contextmenu": "^2.11.0",
    "react-data-export": "^0.6.0",
    "react-datepicker": "^2.9.6",
    "react-dom": "^16.9.0",
    "react-dropzone-component": "^3.2.0",
    "react-intl": "2.4.0",
    "react-perfect-scrollbar": "^1.5.3",
    "react-redux": "7.1.1",
    "react-router-dom": "^5.0.1",
    "react-scripts": "^3.4.0",
    "react-select": "^3.0.4",
    "react-select-async-paginate": "^0.3.10",
    "react-table": "latest",
    "react-transition-group": "^4.3.0",
    "reactstrap": "^8.0.1",
    "redux": "^4.0.4",
    "redux-saga": "^1.0.5",
    "styled-components": "^5.0.0",
    "tailwindcss": "^1.1.2",
    "typescript": "^3.8.2",
    "xlsx": "^0.15.5",
    "yup": "^0.27.0"
  },
  "scripts": {
    "start": "yarn run tailwind && react-scripts start",
    "build": "yarn run tailwind && node ./purge-tailwindcss.js && cross-env react-scripts build",
    "tailwind": "./node_modules/.bin/tailwind build ./src/assets/css/vendor/tailwind.base.css -c ./tailwind.js -o ./src/assets/css/vendor/tailwind.css",
    "test": "react-scripts test --env=node",
    "crt": "bash create-component.sh",
    "eject": "react-scripts eject",
    "lint": "eslint src/**/*.js"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "babel-plugin-import": "^1.13.0",
    "cross-env": "^5.2.0",
    "eslint": "^6.8.0",
    "eslint-config-airbnb": "^18.0.1",
    "eslint-plugin-import": "^2.20.0",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-react": "^7.18.0",
    "eslint-plugin-react-hooks": "^1.7.0",
    "node-sass": "^4.12.0",
  }
}

Don't know how.不知道怎么样But after enabling sourcemap this error doesn't shown.但是在启用sourcemap此错误不会显示。 I removed this command from yarn build :我从yarn build删除了这个命令:

GENERATE_SOURCEMAP=false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM