umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.4k stars 2.66k forks source link

Unexpected token: keyword «const» ,打包报错 #3223

Closed zhilianbi520 closed 5 years ago

zhilianbi520 commented 5 years ago

What happens?

A clear and concise description of what the bug is.

Mini Showcase Repository(REQUIRED)

Provide a mini GitHub repository which can reproduce the issue. Use yarn create umi then upload to your GitHub

How To Reproduce

Steps to reproduce the behavior:

  1. 打包项目报错 20190917193810

利用https://www.yuque.com/docs/share/1d90b8b9-0fd1-454e-81bc-f08ed2b366dc#9757f2c5 这个方案,还是报错,,找不到出问题的依赖包,还有别的解决方式嘛?求解 20190917193934

依赖目录为以下这些:

"dependencies": {
    "@antv/g2": "^3.5.5",
    "@babel/runtime": "^7.4.5",
    "@fullcalendar/core": "^4.1.0",
    "@fullcalendar/daygrid": "^4.1.0",
    "@fullcalendar/interaction": "^4.1.0",
    "@fullcalendar/react": "^4.1.0",
    "@fullcalendar/resource-timegrid": "^4.1.0",
    "@fullcalendar/resource-timeline": "^4.2.0",
    "@fullcalendar/timeline": "^4.2.0",
    "@svgr/webpack": "^4.1.0",
    "ajv": "^6.6.2",
    "alife-logger": "^1.5.4",
    "antd": "^3.18.2",
    "bizcharts": "^3.3.0",
    "bizcharts-plugin-slider": "^2.1.1-beta.1",
    "classnames": "^2.2.6",
    "crypto-js": "^3.1.9-1",
    "dva": "^2.4.0",
    "enquire-js": "^0.2.1",
    "fullcalendar": "^3.10.0",
    "fullcalendar-scheduler": "^1.9.4",
    "hash.js": "^1.1.5",
    "immutable": "^4.0.0-rc.12",
    "iscroll": "^5.2.0",
    "jquery": "^3.4.1",
    "jquery-ui": "^1.12.1",
    "lodash": "^4.17.10",
    "lodash-decorators": "^6.0.0",
    "mathjs": "^5.10.3",
    "memoize-one": "^4.0.0",
    "module": "^1.2.5",
    "moment": "^2.24.0",
    "numeral": "^2.0.6",
    "nzh": "^1.0.3",
    "omit.js": "^1.0.0",
    "path-to-regexp": "^2.4.0",
    "popper.js": "^1.14.6",
    "prop-types": "^15.5.10",
    "qs": "^6.5.2",
    "rc-animate": "^2.8.2",
    "react": "^16.8.1",
    "react-container-query": "^0.11.0",
    "react-copy-to-clipboard": "^5.0.1",
    "react-document-title": "^2.0.3",
    "react-dom": "^16.5.1",
    "react-fittext": "^1.0.0",
    "react-highlight-words": "^0.16.0",
    "react-infinite-scroller": "^1.2.4",
    "react-lines-ellipsis": "^0.14.1",
    "react-router-dom": "^4.3.1",
    "react-to-print": "^2.1.2",
    "redux-persist": "^5.10.0",
    "rollup": "^0.68.2",
    "tooltip.js": "^1.3.1"
  },
  "devDependencies": {
    "@antv/data-set": "^0.10.0",
    "@types/react": "^16.8.18",
    "@types/react-dom": "^16.0.9",
    "antd-pro-merge-less": "^0.2.0",
    "antd-theme-webpack-plugin": "^1.2.0",
    "babel-eslint": "^10.0.1",
    "cross-env": "^5.1.1",
    "cross-port-killer": "^1.0.1",
    "enzyme": "^3.7.0",
    "eslint": "^5.4.0",
    "eslint-config-airbnb": "^17.0.0",
    "eslint-config-prettier": "^3.0.1",
    "eslint-plugin-babel": "^5.3.0",
    "eslint-plugin-compat": "^2.6.2",
    "eslint-plugin-import": "^2.17.3",
    "eslint-plugin-jsx-a11y": "^6.1.2",
    "eslint-plugin-markdown": "^1.0.0-beta.6",
    "eslint-plugin-react": "^7.13.0",
    "gh-pages": "^2.0.1",
    "husky": "^1.1.2",
    "jest-puppeteer": "^3.5.1",
    "lint-staged": "^8.1.7",
    "merge-umi-mock-data": "^1.0.5",
    "mockjs": "^1.0.1-beta3",
    "prettier": "1.15.2",
    "pro-download": "^1.0.1",
    "stylelint": "^9.4.0",
    "stylelint-config-prettier": "^4.0.0",
    "stylelint-config-standard": "^18.0.0",
    "tslint": "^5.10.0",
    "tslint-config-prettier": "^1.10.0",
    "tslint-react": "^3.6.0",
    "uglifyjs-webpack-plugin": "^2.1.3",
    "umi": "^2.6.17",
    "umi-plugin-ga": "^1.1.3",
    "umi-plugin-react": "^1.7.6"
  },

Expected behavior 1. 2.

Context

zhilianbi520 commented 5 years ago

What happens?

A clear and concise description of what the bug is.

Mini Showcase Repository(REQUIRED)

Provide a mini GitHub repository which can reproduce the issue. Use yarn create umi then upload to your GitHub

How To Reproduce

Steps to reproduce the behavior:

  1. 打包项目报错 20190917193810

利用https://www.yuque.com/docs/share/1d90b8b9-0fd1-454e-81bc-f08ed2b366dc#9757f2c5 这个方案,还是报错,,找不到出问题的依赖包,还有别的解决方式嘛?求解 20190917193934

依赖目录为以下这些:

"dependencies": {
    "@antv/g2": "^3.5.5",
    "@babel/runtime": "^7.4.5",
    "@fullcalendar/core": "^4.1.0",
    "@fullcalendar/daygrid": "^4.1.0",
    "@fullcalendar/interaction": "^4.1.0",
    "@fullcalendar/react": "^4.1.0",
    "@fullcalendar/resource-timegrid": "^4.1.0",
    "@fullcalendar/resource-timeline": "^4.2.0",
    "@fullcalendar/timeline": "^4.2.0",
    "@svgr/webpack": "^4.1.0",
    "ajv": "^6.6.2",
    "alife-logger": "^1.5.4",
    "antd": "^3.18.2",
    "bizcharts": "^3.3.0",
    "bizcharts-plugin-slider": "^2.1.1-beta.1",
    "classnames": "^2.2.6",
    "crypto-js": "^3.1.9-1",
    "dva": "^2.4.0",
    "enquire-js": "^0.2.1",
    "fullcalendar": "^3.10.0",
    "fullcalendar-scheduler": "^1.9.4",
    "hash.js": "^1.1.5",
    "immutable": "^4.0.0-rc.12",
    "iscroll": "^5.2.0",
    "jquery": "^3.4.1",
    "jquery-ui": "^1.12.1",
    "lodash": "^4.17.10",
    "lodash-decorators": "^6.0.0",
    "mathjs": "^5.10.3",
    "memoize-one": "^4.0.0",
    "module": "^1.2.5",
    "moment": "^2.24.0",
    "numeral": "^2.0.6",
    "nzh": "^1.0.3",
    "omit.js": "^1.0.0",
    "path-to-regexp": "^2.4.0",
    "popper.js": "^1.14.6",
    "prop-types": "^15.5.10",
    "qs": "^6.5.2",
    "rc-animate": "^2.8.2",
    "react": "^16.8.1",
    "react-container-query": "^0.11.0",
    "react-copy-to-clipboard": "^5.0.1",
    "react-document-title": "^2.0.3",
    "react-dom": "^16.5.1",
    "react-fittext": "^1.0.0",
    "react-highlight-words": "^0.16.0",
    "react-infinite-scroller": "^1.2.4",
    "react-lines-ellipsis": "^0.14.1",
    "react-router-dom": "^4.3.1",
    "react-to-print": "^2.1.2",
    "redux-persist": "^5.10.0",
    "rollup": "^0.68.2",
    "tooltip.js": "^1.3.1"
  },
  "devDependencies": {
    "@antv/data-set": "^0.10.0",
    "@types/react": "^16.8.18",
    "@types/react-dom": "^16.0.9",
    "antd-pro-merge-less": "^0.2.0",
    "antd-theme-webpack-plugin": "^1.2.0",
    "babel-eslint": "^10.0.1",
    "cross-env": "^5.1.1",
    "cross-port-killer": "^1.0.1",
    "enzyme": "^3.7.0",
    "eslint": "^5.4.0",
    "eslint-config-airbnb": "^17.0.0",
    "eslint-config-prettier": "^3.0.1",
    "eslint-plugin-babel": "^5.3.0",
    "eslint-plugin-compat": "^2.6.2",
    "eslint-plugin-import": "^2.17.3",
    "eslint-plugin-jsx-a11y": "^6.1.2",
    "eslint-plugin-markdown": "^1.0.0-beta.6",
    "eslint-plugin-react": "^7.13.0",
    "gh-pages": "^2.0.1",
    "husky": "^1.1.2",
    "jest-puppeteer": "^3.5.1",
    "lint-staged": "^8.1.7",
    "merge-umi-mock-data": "^1.0.5",
    "mockjs": "^1.0.1-beta3",
    "prettier": "1.15.2",
    "pro-download": "^1.0.1",
    "stylelint": "^9.4.0",
    "stylelint-config-prettier": "^4.0.0",
    "stylelint-config-standard": "^18.0.0",
    "tslint": "^5.10.0",
    "tslint-config-prettier": "^1.10.0",
    "tslint-react": "^3.6.0",
    "uglifyjs-webpack-plugin": "^2.1.3",
    "umi": "^2.6.17",
    "umi-plugin-ga": "^1.1.3",
    "umi-plugin-react": "^1.7.6"
  },

Expected behavior 1. 2.

Context

  • Umi Version:2.6.17
  • Node Version:10.15.3
  • Platform: Macos 10.14.6

已找到报错位置,但是无法确定是哪个包 20190917201819

zhilianbi520 commented 5 years ago

已通过更换插件压缩插件:terser-webpack-plugin解决此问题。